Mat*_*att 23 internet-explorer angularjs internet-explorer-11
我当然是一个AngularJS新手,但我无法找到为什么这个代码在Chrome和Firefox中有效,但"Access is denied"
在IE 11的javascript控制台中给出了.
我需要通过经过身份验证的REST调用来显示PDF.理想情况下,这将显示在弹出(预览)类型的窗口中.
到目前为止,代码如下:
$http.post( url, payload, {
headers : {
"Authorization": token
},
responseType: "arraybuffer"
}).success(function ( data ) {
var file = new Blob( [ data ], { type: 'application/pdf' });
var fileURL = URL.createObjectURL( file );
window.open( fileURL );
}
Run Code Online (Sandbox Code Playgroud)
在window.open()
给出了"access is denied"
对IE11的消息,但在Chrome和Firefox的作品.我尝试改为window.location()
,并得到了同样的错误.
这不是跨域问题(一切都在同一个foo.net域中).
小智 55
在Internet Explorer 10中将文本保存在本地文件中
它看起来像IE阻止blob上的window.open,但实现了自己的功能来打开和保存blob.而是试试
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob);
}
else {
var objectUrl = URL.createObjectURL(blob);
window.open(objectUrl);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19985 次 |
最近记录: |