【发布时间】:2019-07-26 10:16:24
【问题描述】:
我收到一个弹出窗口“您要允许此网站在您的计算机上打开应用程序吗?”下载pdf时在IE11中。
使用下面的代码,打开正确的弹出窗口“您要打开还是保存文件”?还有“你想让这个网站在你的电脑上打开一个应用吗?”
const headerOptions = new HttpHeaders({
// 'Cache-Control': 'private',
// 'Content-Disposition': 'attachment; filename = ' + filename,
'Content-Type': 'application/pdf'
});
const requestOptions = {
headers: headerOptions,
responseType: 'blob' as 'blob'
};
this.http
.post(
`${this.url}?id=${id}&datasource=${datasource}&device=${device}&browser=${browser}&link=${link}`,
dataObj,
requestOptions
)
.catch(error => {
return this.clickHandlerError(error);
})
.pipe(
map((data: any) => {
const blob = new Blob([data], {
type: 'application/pdf'
});
window.navigator.msSaveOrOpenBlob(blob, filename);
})
)
.subscribe((result: any) => {});
我希望有正确的弹出窗口来打开或保存文件。
【问题讨论】:
标签: angularjs internet-explorer-11