Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here's one I took from somewhere and optimized that is just a bookmarklet, so there's nothing remote:

data:text/html,<title>Notepad</title><textarea autofocus spellcheck=0 style="position:fixed;inset:0;padding:1em;border:0;font:monospace">

Your text actually survives a reboot in Chrome.

Can anyone think of a way to store the textarea value in the URL? I tried using JS to set a # but it's nonsensical in this context.

Edit: here's the best I could do:

data:text/html,<title>Notepad</title><textarea id=t autofocus spellcheck=0 style=position:fixed;inset:0;padding:2em;border:0;font:monospace></textarea><a id=s style=position:fixed;top:10px;right:10px>Right-click Open to save...</a><script>[,P,S]=location.href.slice(15).match(/(.<textarea[^>]>)[^]?(<\/textarea>.)/),t.oninput=U=_=>s.href='data:text/html,'+P+encodeURIComponent(t.value.replace(/&/g,'&amp;').replace(/<\/textarea/g,'&lt;/textarea'))+S,U()</script>





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: