【问题标题】:Pop-up when a pdf is download in IE11在 IE11 中下载 pdf 时弹出
【发布时间】: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


    【解决方案1】:

    这是一条客户端错误消息,让用户知道此操作将导致应用程序在用户系统上打开。如果您希望停止此操作,则需要配置客户端计算机而不是 Web 应用程序。

    我建议您检查一下您的 IE 选项并禁用此提示。

    如果问题仍然存在,您可以重置 IE 应用程序有助于解决此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-29
      • 2015-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多