3 ms·
Or this; data:text/html,<script>alert('pasting code from the internet in to your address bar should not be encouraged');</script>
by onion2k 6y ago
Or this;
data:text/html,<script>alert('pasting code from the internet in to your address bar should not be encouraged');</script>
- forgotpwd16 6y agoGood note. The implications of pasting arbitrarily code in address bar is known as self-XSS which can be used to hijack online accounts.
- kozhevnikov 6y agoEncouraged? No, but data urls are heavily sandboxed, e.g. can't even access own cookies.
- katsura 6y agoAlthough, this is not a data URL per se, but just pasting it in the URL bar allows you to do pretty much anything: javascript:alert(document.cookie)
- tlamponi 6y agoMy Firefox here does not allows that. 1. It strips the JavaScript: part away if I just paste it once 2. Even if I re-add it manually, it still does no alert Ergo, a sane browser can be quite sandboxed to avoid the average user to do stupid to easily.
- myfonj 6y agoYup. javascript: URL (either pasted or typed into URL bar) are long gone as self-xss precaution. The only way you can run javascript: URL is bookmarking it and invoking resulting bookmarklet. And AFAIK there is no way to re-enable it again. You have to start web developers console to rund ad-hoc JavaScript code in pages' context. (I see this as an end of glorious era of "you can do pretty much anything in URL bar".)
- Wowfunhappy 6y agoIs this any different than running code from the internet by typing a website into your address bar?
- thebeefytaco 6y agoWell I just quickly tested, and NoScript doesn't seem to block that, whereas it would if it were externally loaded or inline JS on a web page. So that's one difference. Not that the type of person to use NoScript would likely paste obvious javascript into the address bar... Edit: Doesn't look like you can create a valid URL with that format, but it can be launched via pasting in (obviously), a bookmark (which the contents of which could be obfuscated by telling a user to drag an image to the bookmark bar and click it), and can be launched via command line, e.g. start firefox "data:text/html,<script>alert('');</script>"