3 ms·
does this prevent you from pasting js like this into the URL bar? javascript:let $code=document.createElement('textarea');let source=document.body.outerHTM
by azeirah 5y ago
does this prevent you from pasting js like this into the URL bar?
javascript:let $code=document.createElement('textarea');let source=document.body.outerHTML;$code.innerHTML = source;document.body.appendChild($code);
For those who don't feel like reading a js oneliner, it reads the page source and adds an element to the page that displays all of it.
- sbierwagen 5y agoDoes pasting javascript into the URL bar execute it?
- azeirah 5y agoYes, the `javascript:` prefix tells the browser to interpret the url as javascript. Try this one for example javascript:alert('hello world'); Do note that some browsers remove the `javascript:` part when you paste it into the url bar because it could easily be used maliciously so you might have to type that yourself.