Use pdf.js: Cross domain access error



I like to insert a pdf in a HTML article with the help of pdf.js.

It works perfectly in the aem preflight app, but not in our own developper test app.

In our app there is the following error:

XMLHttpRequest cannot load file:///var/mobile/Containers/Data/..../test.pdf. Cross origin requests are only supported for HTTP.

So is it possible to set <access origin="*" /> or somithing like this on our own app, so it can load local files?

Or what is the difference from our own app to the preflight app?

Thanks, David

Accepted Solutions (1)

Accepted Solutions (1)




Hi David,

I've seen this library work in other applications so I believe that this is due to a known issue [1] with using the WKWebViewEngine in iOS.

Can you try creating a new app with the WKWebView plugin disabled?

[1] [CB-10143] Local file:// url XmlHttpRequests are not allowed in WKWebViewEngine - ASF JIRA

Answers (0)