在 IE11 中下载 pdf 时弹出
Pop-up when a pdf is download in IE11
我在 IE11 中下载 pdf 时弹出 "Do you want to allow this website to open an app on your computer?"。
在 angularts 中使用下面的代码可以打开正确的弹出窗口 "Do you want to open or save the file"?还有"Do you want to allow this website to open an app on your computer?"
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) => {});
我希望有正确的弹出窗口来打开或保存文件。
这是一条客户端错误消息,让用户知道此操作将导致应用程序在用户系统上打开。如果你想让它停止,那么你需要配置客户端机器而不是网络应用程序。
我建议您检查您的 IE 选项并禁用此提示。
如果问题仍然存在,您可以重置 IE 应用程序以帮助解决此问题。
我在 IE11 中下载 pdf 时弹出 "Do you want to allow this website to open an app on your computer?"。
在 angularts 中使用下面的代码可以打开正确的弹出窗口 "Do you want to open or save the file"?还有"Do you want to allow this website to open an app on your computer?"
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) => {});
我希望有正确的弹出窗口来打开或保存文件。
这是一条客户端错误消息,让用户知道此操作将导致应用程序在用户系统上打开。如果你想让它停止,那么你需要配置客户端机器而不是网络应用程序。
我建议您检查您的 IE 选项并禁用此提示。
如果问题仍然存在,您可以重置 IE 应用程序以帮助解决此问题。