Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not allowed to load blob pdf resource in Microsoft Edge [duplicate]

This app is used to collect information from a DB and make a .pdf file from it.

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;

I'm receiving an error only in the Microsoft Edge console. A lot of people say it's a security problem with the Edge browser.

Can anyone provide me help for this?

like image 602
Stefan Avatar asked Jun 29 '17 11:06

Stefan


Video Answer


1 Answers

The old solution for Microsoft browsers still applies:

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

Source here

like image 194
Cezar Crintea Avatar answered Oct 16 '22 08:10

Cezar Crintea