Answers for "download source javascript code from website"

0

javascript download current html page

// in the current page, download the html source
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(document.documentElement.outerHTML);
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.txt';
hiddenElement.click();
Posted by: Guest on December-29-2020
0

js download html

<a onclick="this.href='data:text/html;charset=UTF-8,'+encodeURIComponent(document.documentElement.outerHTML)" href="#" download="page.html">Download</a>
Posted by: Guest on May-15-2021

Code answers related to "download source javascript code from website"

Browse Popular Code Answers by Language