【问题标题】:Not allowed to load blob pdf resource in Microsoft Edge [duplicate]不允许在 Microsoft Edge 中加载 blob pdf 资源 [重复]
【发布时间】:2017-12-03 02:09:41
【问题描述】:

此应用程序用于从数据库收集信息并从中制作 .pdf 文件。

this.reportsService.getTelerikReport({ reportId: this.selectReportId, startDate: this.startDate, endDate: this.endDate, ReportItems: listCheckItems})
        .then(response => {
            this.fileLoading = false;
            var file = new Blob([response], { type: "application/pdf" });
            this.fileUrl = this.$sce.trustAsResourceUrl(URL.createObjectURL(file));
            this.isReportGenerated = true;

我仅在 Microsoft Edge 控制台中收到错误消息。很多人说这是 Edge 浏览器的安全问题。

谁能为此提供帮助?

【问题讨论】:

    标签: javascript microsoft-edge


    【解决方案1】:

    微软浏览器的旧解决方案仍然适用:

    if (window.navigator && window.navigator.msSaveOrOpenBlob) {
        window.navigator.msSaveOrOpenBlob(blob);  
    }
    else {
        var objectUrl = URL.createObjectURL(blob);
        window.open(objectUrl);  
    }
    

    来源here

    【讨论】:

    • 在最新版本的 IE11 中,此属性“msSaveOrOpenBlob”不再存在。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-07
    • 2015-12-07
    • 2016-10-08
    • 2016-11-04
    • 2021-05-26
    相关资源
    最近更新 更多