我正在尝试使用 a
标记下载 HTML 文件,下面是我的代码。
它可以在 Chrome 和 Firefox 中运行,但不能在 IE 中运行
var a = document.createElement("a");
a.href = "data:text/html,"+htmlContent;
a.target = '_blank';
a.download = "test.html";
document.body.appendChild(a);
a.click();
任何可能导致问题的想法
最佳答案
download
<a>
的属性ie 不支持该元素。请参阅http://www.w3schools.com/tags/att_a_download.asp
关于javascript - 使用标签下载 HTML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31027311/