Lurker News

Comments (288) 84 threads

Show all comments

Showing thread 5 of 84

TekMol1 reply#
This could also be a bookmarklet. That would make it more secure as bookmarklets only have access to the page you use them on.

Looking at the code, you can indeed run it as a bookmarklet. I went to https://www.example.com and typed this in the browser console:

    s1=document.createElement('script'); s1.src='https://code.jquery.com/jquery-3.7.0.slim.min.js'; document.head.appendChild(s1); s2=document.createElement('script'); s2.onload=()=>window.cssProReady(); s2.src='https://csspro.com/demo-build/mainnewnew.js'; document.head.appendChild(s2);
Boom! The tool is running.

So prefixing that line with "javascript:" and putting it into a bookmark would let you use it on any site you wish, simply by clicking the bookmark. Without having to install an extension.
Would be a good alternative the author could offer imho.

evanreichard1 reply#
Any site that has a half decent Content Security Policy would prevent this. (You can try on HN, GitHub, etc and it fails)

However it may work as a UserScript depending on the UserScript engine.

graftak#
Sure but the main proposition for this tool is for it to be used during local development where CSP is often/always omitted.