Mobile hybrid pdf viewer error .

When I try to open a PDF file in de “File Document Viewer” in the Android mobile Hybrid app I get the following error. PDF.js v1.10.88 Messages: file origin does not match viewer’s In Chrome and on mobile, it works fine I only got the error in the mobile app.
3 answers

Hi Wim,

Are you working with a URL or Mendix File document? I might thet the PDF viewer uses an iframe, and the origins shouldmatch

Cheers, Andries


Hi Wim, I ran into the same issue with error: Refused to display ..widgets/FileDocumentViewer/lib/pdfjs/web/viewer.html?file=.. in a frame because it set 'X-Frame-Options' to 'sameorigin'.

While I didn't solve the issue, here are the things I learned so far. The reason for using the PDF.js library is because Android does not have a builtin PDF viewer, unlike iOS. 

The widget works fine in a browser on dekstop or phone, but not on your mobile app. If I understand correctly this is because of the cross domain request, see


This widget unfortunately tries to open using the filesystem which is not allowed because file:// does not work in hybrid anymore. Please note that this is a web widget.