Getting blocked a frame with origin issue
- Dominant language
- JavaScript
- Stars
- 4.5k
- Forks
- 688
- PR merge metrics
- No merged PRs in 30d
Description
Hi I am getting CORS issue while calling printJs(URL).
structure is as below,
Main Application url is `http:localhost:5000`. App renders iframe app which is at `http:localhost:5000/data-center/index.html`
(iframe sandbox attribute is like `sandbox="allow-scripts allow-popups allow-modals allow-forms allowdownloads allow-same-origin"`)
PrintJS package, using 1.0 version and it makes call to `printJS(URL)` from internal iframe.
//print URL is like, `blob:http:localhost:5000/[guid value]`
Error produce at below code in printjs .
print.js:
```
try{
iframeElement.focus(); // iframeElement = iframe#printJS { src: blob:http://localhost:5000/123456789-33333-56789-23343', src: '', name: '', sandbox: DOMTockenList(0..)
...
// other browsers
iframeElement.contentWindow.print(); // CORS error created at here contentWindow .
} catch(error){ params.onError(error);}
finally {
(o,_function.cleanup)(params);
}
}
```
Error:
Uncaught DOMException: Blocked a frame with origin "http://localhost:5000" frame accessing a cross-origin frame.
at performPrint (webpack-internal:///./node_modules/print-js/dist/print.js:898:35)
at HTMLIframeElement.iframeElement.onload (webpack-internal:///./node_modules/print-js/dist/print.js:852:11)
..
It works when, I remove, "sandbox" attribute but I can not removed. Can you please advise if any changes on printjs or possible solution on this issue ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.