WebViewer does not load in macOS Safari when embedding via iframe

Skip to first unread message


Jun 29, 2017, 8:51:32 AM6/29/17
to PDFTron WebViewer
Hi guys,

with the latest release of WebViewer we found that it is no longer possible to embed the viewer via iframe into a page of different origin in Safari.
It seems that this only affects the Safari browser, we did not see other browsers behaving this way in our tests.

For demonstration purposes i prepared a simple CodePen snipped that embeds the WebViewer Showcase in an iframe.
It loads perfectly fine in Chrome but fails to load in Safari:

Following errors are thrown:
SecurityError (DOM Exception 18): IDBFactory.open() called in an invalid security context
ReferenceError: Can't find variable: Modernizr

 We actually need this iframe around the viewer as it is currently the only way to load the viewer in a page of different origin as discussed here:

Could you please look into this issue? Thanks.
Message has been deleted
Message has been deleted

Justin Jung

Jun 29, 2017, 2:43:46 PM6/29/17
to PDFTron WebViewer

We've updated Modernizr in WebViewer 3.0 and it seems like there is a problem with it in this particular case in Safari.
We made a small fix to Modernizr to work around this problem, you can replace modernizr.custom.js in lib/html5/external with the attached file.
We'll include this in a future release.

Justin Jung
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
0 new messages