我当然是一个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域中).