gpt4 book ai didi

javascript - 在 IE9 中使用 JS 将 PDF 下载为 Blob

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:43:31 24 4
gpt4 key购买 nike

我有一个 blob,想下载它。它适用于 Chrome、Firefox、IE10 及更高版本。问题是 IE9。

                    var isIE = /*@cc_on!@*/false || !!document.documentMode;  
var blob = new Blob([data], {type: "application/pdf"});
if (isIE) {
window.navigator.msSaveOrOpenBlob(blob, "Download.pdf");
} else {
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "Download.pdf";
link.id = "TEST";
$('body').append(link);
document.getElementById("TEST").click();
}

问题出在哪里? IE 将 2.083 作为 URL 中字符的最大限制。也许这很关键。我有什么选择?我必须支持 IE9...谢谢。

最佳答案

如您所见here IE 版本 10 支持 Blob 构造函数。您可能需要使用 PDF.js .

关于javascript - 在 IE9 中使用 JS 将 PDF 下载为 Blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28196065/

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