angular - 使用角度在IE中打开流pdf
问题描述
我会在导航器中打开一个 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 Explorer 和 Firefox 中,当我单击链接时,会打开一个新选项卡,然后在 url 栏中我得到这个地址blob:http://......code....
如何在 IE 中读取 blob?
解决方案
推荐阅读
- r - 在 R 中绘制具有不同标签和颜色的地图
- android - Android ScrollView 不滚动
- c# - 在测试服务器中部署后 Microsoft.Owin 错误
- azure - 在 botframework 中获取建议操作的值
- java - 无法使用我的 SpringSecurity 配置处理由 @PreAuthenticate 引起的 AccessDeniedException
- pandas - 解析 CSV 文件时出现 KeyError
- spring - 如何在我的 Spring Boot 应用程序中支持 PUT 方法?
- mongodb - 带空格键的 Accordion Bootstrap 表
- c++ - [C++][std::sort] 它是如何在 2D 容器上工作的?
- csrf - 创建authenticator.token时出现Plone 5错误