Cross-origin frame issue when printing in Chrome

Hi there,

I set up Collabora with our own WOPI implementation, everything works, great, except for printing. When I press the print button I get an error in the JS console of the browser:

Uncaught DOMException: Blocked a frame with origin "https://collabora.XXXX" from accessing a cross-origin frame.
    at NewClass._onIframeLoaded (https://collabora.XXXX/browser/ce39a9d/bundle.js:1:1928895)

I also tried setting up Collabora on the same sub-domain, it was a pain, but it didn’t change anything. Looking at the code , CODE is creating an iframe with no src attribute, and then changing src to the Blob object URL (fine). But the error happens when print() is called, on this line:

this._printIframe.contentWindow.print();

Not sure how I can fix this? I couldn’t find anything in Github issues.

This happens in Chrome, with Firefox printing seems to work correctly.

Thanks to anyone who could help :slight_smile:

Same issue here, only with Chrome; Firefox works like a charm.

Hi, do you have frame-src 'self' blob: in the CSP?

Not usually, but I tried, and it doesn’t change. Just for being sure, I tried again, and checked in the network console to see if the headers were correctly set. With the CSP policy you supplied set in the parent frame, I have the same issue :frowning:

What is the CSP in your case?

Ah! It wasn’t a CSP issue at all, it was because we used the sandbox attribute on the Collabora iframe. Removing it fixed the issue, as even allowing all sandbox options didn’t fix it. Not the best for security, but at least it works.

Thanks for your help!