Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript in plain/html files does not work if not urlencoded properly. #5

Open
mofosyne opened this issue Aug 31, 2015 · 0 comments

Comments

@mofosyne
Copy link
Owner

 data:text/html,<pre style=line-height:1><script>d=document;for(i=1;i<4001;i++){d.write(Math.random()<.5?"\u2571":"\u2572");d.write(i%80?"":"\n")}</script>

doesn't work, but this does:

 data:text/html;base64,PHByZSBzdHlsZT1saW5lLWhlaWdodDoxPjxzY3JpcHQ+ZD1kb2N1bWVudDtmb3IoaT0xO2k8NDAwMTtpKyspe2Qud3JpdGUoTWF0aC5yYW5kb20oKTwuNT8iXHUyNTcxIjoiXHUyNTcyIik7ZC53cml0ZShpJTgwPyIiOiJcbiIpfTwvc2NyaXB0Pg==

Btw, this was sourced from https://twitter.com/botond_balazs/status/637960240055615488


This is how firefox errors shows up:

ORIGNAL: <pre style=line-height:1><script>d=document;for(i=1;i<4001;i++){d.write(Math.random()<.5?"\u2571":"\u2572");d.write(i%80?"":"\n")}</script>
PARSED:: <pre style=line-height:1><script>d=document;for(i=1;i<4001;i++){d.write(Math.random()<.5?"\u2571":"\u2572");d.write(i€?"":"\n")}</script>

ANS edit:

https://www.reddit.com/r/programming/comments/3iy6fk/javascript_maze_generator_in_a_tweet/cukpbai

You can make it work via: spacing out out the %80 to % 80

So it was due to mistaking the %80 being a percent encoded character. Thus is something to be aware of.


http://qrfree.kaywa.com/?l=1&s=8&d=data%3Atext%2Fhtml%2C%3Cpre+style%3Dline-height%3A1%3E%3Cscript%3Efor%28i%3D4e3%3Bi--%3B%29document.write%28%28Math.random%28%29%3C.5%3F%22%5Cu2571%22%3A%22%5Cu2572%22%29%2B%28i%25+80%3F%22%22%3A%22%5Cn%22%29%29%3C%2Fscript%3E

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant