| 1 | <!DOCTYPE html> |
|---|
| 2 | <html lang='en' xml:lang='en'> |
|---|
| 3 | <head> |
|---|
| 4 | <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> |
|---|
| 5 | <script src="https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.js"></script> |
|---|
| 6 | </head> |
|---|
| 7 | <body> |
|---|
| 8 | <script type='application/javascript'> |
|---|
| 9 | function downloadFile() { |
|---|
| 10 | document.getElementById('editor1').blur(); |
|---|
| 11 | var blob = new Blob(["some string"], { |
|---|
| 12 | type: "text/plain;charset=utf-8" |
|---|
| 13 | }); |
|---|
| 14 | saveAs(blob, "file.txt"); |
|---|
| 15 | } |
|---|
| 16 | </script> |
|---|
| 17 | <div id='maincontainer'> |
|---|
| 18 | <div id='contentwrapper' style="margin-top: 100px;"> |
|---|
| 19 | <div id='editor1' contenteditable="true"> |
|---|
| 20 | <p>Some content blah blah</p> |
|---|
| 21 | </div> |
|---|
| 22 | <button onclick="downloadFile()">download file</button> |
|---|
| 23 | <iframe id="iframe" width="170" height="30"></iframe> |
|---|
| 24 | </div> |
|---|
| 25 | </div> |
|---|
| 26 | </body> |
|---|
| 27 | </html> |
|---|