angularjs - 在 IE11 中下载 pdf 时弹出
问题描述
我收到一个弹出窗口“您要允许此网站在您的计算机上打开应用程序吗?” 在 IE11 中下载 pdf 时。
使用下面的代码,打开正确的弹出窗口“您要打开还是保存文件”?还有“你想让这个网站在你的电脑上打开一个应用程序吗?”
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) => {});
我希望只有正确的弹出窗口来打开或保存文件。
解决方案
这是一条客户端错误消息,让用户知道此操作将导致应用程序在用户系统上打开。如果您希望停止此操作,则需要配置客户端计算机而不是 Web 应用程序。
我建议您检查您的 IE 选项并禁用此提示。
如果问题仍然存在,您可以重置您的 IE 应用程序可以帮助解决此问题。
推荐阅读
- python - Pandas 在指定索引 groupby 之后找到最高值
- python - Numpy 无法访问元素,我应该只是取消嵌套数组还是我的数组构建错误/效率低下?
- react-native - 尝试运行 React Native ios 应用程序时无法修复这 2 个错误
- docker - docker images 显示意外的创建时间
- jquery - 获取输入日期并将其输入为 Jquery datepicker 的 minDate
- python - 如何使用嵌套的 for 循环更新我的字典列表?
- godot - 如何扩展 Godot 的 Button 以区分左键单击和右键单击事件?
- javascript - 使用“setInterval”和“setTimeout”循环不起作用
- c++ - 将c多维数组转换为多维c++向量
- javascript - 等待mapstate中的数据完成加载