【发布时间】:2018-02-28 19:05:50
【问题描述】:
Java Web 应用程序:
我做了一些研究以查看从服务器检索到的 pdf 数据,即“应用程序/pdf”内容响应。
下面的 js 可以工作,但在 IE 中它打开/保存一个 pdf 文件,而不是打开一个新窗口来显示 pdf。
如何为IE打开一个新窗口?
var res = $http.post(printURL, dataset, {responseType: 'arraybuffer'});
res.success(function(response, status, headers, config) {
var file = new Blob([response], {type: 'application/pdf'});
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(file);
}
else{
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
}
【问题讨论】:
标签: internet-explorer pdf blob