2017-07-18 60 views
4

我用下面的代码加载PDF文件到一个窗口,从一个AJAX请求:如何使用斑点和createObjectURL在边缘和IE

$('#divEmbedPdf').empty(); 

var req = new XMLHttpRequest(); 
req.open('GET', '/api/read/file?p_key=<some key>', true); 
req.responseType = 'blob'; 
req.setRequestHeader('SomeAuthHeader', 'SomeTokenValue'); 
req.onload = function (event) { 
    var fblob = req.response; 

    $('<iframe/>', { 
     src: window.URL.createObjectURL(fblob), 
     frameborder: 0, 
     marginheight: 0, 
     marginwidth: 0, 
     css: { 
      position: 'absolute', 
      width: '100%', 
      height: '100%' 
     } 
    }).appendTo($('#divEmbedPdf')); 
} 
req.send(); 

这工作正常,在Chrome和FF,但边缘是扔出现以下错误:

SEC7134: Resource 'blob:C88E2211-80B6-4933-B5E1-0E8DE3665368' not allowed to load. 

有没有办法使这项工作与边缘?我不想打开一个新窗口,因为它在一个弹出窗口中运行,我想在不打开和关闭的情况下查看它。正如你会注意到我在认证请求中发送一个自定义头,所以我不能只是做一个iframe并将src属性设置为一个路径。

回答

1

我想现在你有你的answer

Thank you for providing this information about the issue. We previously confirmed the problem, and have published a solution on a new build of Edge. We are resolving this issue as a duplicate of an existing internal bug report. We look forward to additional feedback you may have on how we can improve Microsoft Edge.