📌  相关文章
📜  javascript 下载当前 html 页面 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:40.387000             🧑  作者: Mango

代码示例2
var textToSave = 'this is a test';

var hiddenElement = document.createElement('a');

hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.txt';
hiddenElement.click();