Unable to download blob in firefox due to CSP error

Viewed 1485

I am trying to download a PDF file from the blob. The whole thing is in the iframe and when I try to download it, it throws this error in console: Content Security Policy: The page’s settings blocked the loading of a resource at blob:http://localhost:8080/myApp/31d389m6-8njb-n7gv-427n-bm86ynte36hc("child-src"), I have tried this:

const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = fileName || 'download';
document.body.appendChild(a);
const clickHandler = function() {
    setTimeout(function(){
        URL.revokeObjectURL(url);
        this.removeEventListener('click', clickHandler);
        a.parentNode.removeChild(a);
    }, 150);
};
a.addEventListener('click', clickHandler, false);
a.click();

I have added <meta http-equiv="X-UA-Compatible" content="IE=edge"> to both main page and as well as in the iframe, still this error is there. It is working on other browsers like chrome and edge. Is there anything I am missing?

1 Answers
Related