'Cross Origin Error on iframe with blob URL
We have a url like 'https://www.example.com'
In the page we set the domain as document.domain = example.com
In the page, we need to print a pdf which we get from a web service so the code is like below.
requestPdf().then((pdfData) => {
const pdfBlob = new Blob([pdfData], { type: 'application/pdf' });
const pdfUrl = URL.createObjectURL(pdfBlob);
// pdfUrl is something like this:
// blob:https://www.example.com/xyzc-wertas-asdre
iframeElement.attribute('src', pdfUrl);
});
On this case, when we try to print iframe, we get cross domain error. Is there a way to bypass this error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
