Mobile hybrid pdf viewer error .

0
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.
asked
3 answers
1

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

answered
0

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 https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr
 

answered
0

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.

 

Regards

Diego

answered