4 ms·
So even a data URI can be valid JS syntax data:document/document,alert('hi') If ran as JS it will alert "hi". If put into a link it will force the browser t
by soheil 5y ago
So even a data URI can be valid JS syntax
data:document/document,alert('hi')
If ran as JS it will alert "hi". If put into a link it will force the browser to download a document containing the alert statement.
- lucideer 5y agoThat data URI happens to use `document` which happens to be a browser global, so most data URIs won't work. e.g. running the above in Node gives: Uncaught ReferenceError: document is not defined For anyone unfamiliar with JS, the above string is parsed as: (label): (variable cast to int) / (variable cast to int), // evals to NaN (function call) // evals