Skip to content Skip to sidebar Skip to footer

Download Current Html File

How is it possible, to let the user download the current html page? The webpage loads the text using ajax, so my code doesn't works, because it downloads the original state of the

Solution 1:

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

Post a Comment for "Download Current Html File"