Load current html file

How is it possible for the user to load the current html page? The webpage loads the text using ajax, so my code doesn't work because it loads the original page state:

<a href="URL_OF_THIS_PAGE" download="page.html">Download</a>

      

+3
javascript html


source to share


1 answer


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

      



+11


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics