gpt4 book ai didi

javascript - 类型错误 : Object doesn't support this action in IE 11

转载 作者:搜寻专家 更新时间:2023-11-01 04:13:03 24 4
gpt4 key购买 nike

这在谷歌浏览器中运行良好,但在我的代码中下面提到的行中在 Internet Explorer 中出现错误。谁能建议我需要对其进行哪些更改才能在 IE 中工作。

var file = new File([JSON.stringify($localStorage)], "somefile.txt", {type: "text/plain;charset=utf-8"});

最佳答案

Link to original answer

换句话说,IE 11 不支持 new File() 构造函数,因此您必须改用 blob。这是一个基本示例:

var myArr = ["Hello", "World", "123", "Howdy"];
var b = new Blob([JSON.stringify(myArr)], {type: "text/plain;charset=utf-8"});
window.navigator.msSaveBlob(b, "OutputFile.txt");

现在您应该会收到下载提示。

关于javascript - 类型错误 : Object doesn't support this action in IE 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47881250/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com