Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data:text/html, <html>
- <style type="text/css">
- body{overflow:hidden;}
- #iframe{display:none;}
- #div{position:absolute;top:0px;left:0px;width:100%;height:10000px;}
- #saveButton{z-index:2;position:absolute;top:0px;right:0px;}
- </style>
- <script>
- function save(){
- var note = document.getElementById('div').innerHTML;
- note = note.replace(/(<div><br>)*<\/div>/g, '\n');
- note = note.replace(/<div>/g, '');
- /* replaces some html entities */
- note = note.replace(/ /g, ' ');
- note = note.replace(/&/g, '&');
- note = note.replace(/</g, '<');
- note = note.replace(/>/g, '>');
- document.getElementById('saveButton').setAttribute(
- 'href',
- 'data:Content-type: text/plain, ' + escape(note)
- );
- }
- </script>
- <a id="saveButton" target="iframe" download="note.txt" href="#" onclick="save();">Save</a>
- <iframe id="iframe"></iframe>
- <div contenteditable id="div"></div>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement