简体   繁体   English

IE11 'Blob 未定义' 错误

[英]IE11 'Blob is undefined' error

I'm trying to download a file from the browser.我正在尝试从浏览器下载文件。

In JS I try to create a Blob from the data I get returned from the server but in IE11 the Blob is undefined and therefore cannot be created.在 JS 中,我尝试根据从服务器返回的数据创建 Blob,但在 IE11 中 Blob 未定义,因此无法创建。

JS fails in this line with error : 'Blob' is undefined JS 在这一行失败并出现错误:'Blob' 未定义

Works correctly in Chrome and Firefox.在 Chrome 和 Firefox 中正常工作。

var blob = new Blob([data], {'type':"application/csv"});

Any suggestions?有什么建议?

The Blob object is available from IE10 (included), see: https://developer.mozilla.org/en/docs/Web/API/Blob Blob 对象可从 IE10(包括)获得,请参阅: https : //developer.mozilla.org/en/docs/Web/API/Blob

So it should be working, anyhow if you need to support lower versions, there's a polyfill - https://github.com/eligrey/Blob.js/所以它应该可以工作,无论如何如果你需要支持较低版本,有一个 polyfill - https://github.com/eligrey/Blob.js/

Edit: make sure you're not running IE11 emulating an older version (F12).编辑:确保您没有运行模拟旧版本 (F12) 的 IE11。

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

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