0
我试图使用uri(代码如下)下载png文件。它可以在Chrome,Firefox和Safari中运行 - 但在Internet Explorer中不能(当然)。我在Windows 7上,所以我在边缘文档模式下使用IE11。错误是“传递给系统调用的数据区域太小”。我读过的this MDN postInternet Explorer - 传递给系统调用的数据区太小 - 使用uri下载png
IE9及更高版本,以及封边,支持在CSS数据URI和JS 文件,而不是在HTML文件中,与4GB的最大尺寸。
我的URI只有1410字节(使用uri.length)。任何想法,为什么我得到这个大小的数据错误,以及如何解决它?
下载功能:
function downloadURI(uri, name) {
var link = document.createElement("a");
link.download = name;
link.href = uri;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
delete link;
}
的URI格式:
"data:image/png;base64,iVBORw0KGgo ETC..."
'delete link;' - > ['delete operator'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete):_“任何用var声明的属性不能从全局范围或功能范围中删除。“_ – Andreas
https://stackoverflow.com/questions/20844644/why-am-i-getting-this-error-in-ie – Andreas
@Andreas - 我试过了= >'if(navigator.msSaveBlob){\t return navigator.msSaveBlob(new Blob([uri],{type:“image/png”}),name);}' 它下载得很好,但文件无法读取作为PNG。建议? – mseifert