crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

Cannot print from mobile devices #632

Open khlilturki97 opened 2 years ago

khlilturki97 commented 2 years ago

When i try to print from printjs.crabbly.com from a mobile device, iget the following error

Blocked a frame with origin "https://printjs.crabbly.com" from accessing a cross-origin frame.

image

it works from a laptop

mpaz-phs commented 2 years ago

Any update on this issue? I am having the same issue, mainly with Chrome/iOS & Android.

smithachalla commented 2 years ago

Any update? Same issue with these settings on on edge

image

memen45 commented 8 months ago

Same error here in Kiwi browser (which is Chrome for Android based). Kiwi actually has developer tools available in the app and the print does not work and results in the same DOMException as shown above:

Uncaught DOMException: Blocked a frame with origin "< >" from accessing a cross-origin frame. 
    at performPrint (< >/print-js.js)
    at iframeElement.onload (< >/print-js.js)

Probably related to #600 as well. I have actually tried to implement the iframe myself before using this library and got the same error. The issue seems to be caused by blob:https://url is treated as a different origin than http://url, since the protocol is different. According to some SO pages, postMessage combined with an eventlistener should be used, however, I could not get a working postMessage + eventListener registered without triggering the cross-origin Exception.