繁体   English   中英

下载当前的html文件

[英]Download current html file

如何让用户下载当前的html页面呢? 网页使用ajax加载文本,因此我的代码不起作用,因为它下载了页面的原始状态:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM