Created
January 21, 2021 19:46
-
-
Save Narigo/670e39d7d6d456db9c5e07ae78b7adc7 to your computer and use it in GitHub Desktop.
data URIs are working in the browser 🤯
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
seeing the alert? | |
<script src="main.js" type="module"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import somethingFromADataUrl from "data:application/javascript;charset=utf-8;base64,ZXhwb3J0IGRlZmF1bHQgJ2Zhc3QtZmlsZSc7"; | |
alert(JSON.stringify({ somethingFromADataUrl })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only working when served through a HTTP server, not as a file:///somewhere/index.html