在IE中使用angular打开流pdf

时间:2018-04-27 09:53:22

标签: angular internet-explorer blob

我会在导航器中打开一个pdf文件

实际上Chrome正在运行。当点击文件时pdf正在新窗口中打开

public openFile(path) {
  let url='/download/';
  let headers = new HttpHeaders();
  let pathFile= new HttpParams().set('pathFile', path);
  return this.httpClient.get(url,{params:pathFile, responseType: 'blob'})
}

然后在我的组件中

openFile(path){
  this.creditPoliciesService.openFile(path).toPromise().then (data => {
    var blob = new Blob([data], {type: 'application/pdf'}); 
    var fileURL = URL.createObjectURL(blob); 
    window.open(fileURL);
});

在Internet Expolorer和Firefox中,当我点击链接时会打开一个新标签然后在网址栏中我得到这个地址blob:http://......code....

如何在IE中读取blob?

0 个答案:

没有答案
相关问题