Serve local .pdf file on mobile

I put this two file in /public/pippo folder, and serve it by:

<a href="/pippo/Foto.jpg">Foto</a>		
<a href="/pippo/Template.pdf">Template</a>

If I build the project for a WebApp, and using it by Chrome on a PC, it work, i can open the .jpg and the .pdf simply by clicking on the link.
Instead if I build the project for an Android Meteor App, and load it on my Android Device (Chrome browser installed), the .jpg work, but the .pdf do not work.
When i click on the .pdf link nothing happen.

Is there a solution ? is it a standard behavior ?

Try some of these answers:

It looks like the app wrapper can’t display PDFs directly, you have to open a new window or external browser on Cordova.

I already try this solution, it will only work if the file url is from web but cannot load local file. For example, it only can load “http://example.com/test.pdf” but not “/test.pdf” url

So there is no solution for this problem ?
It is a real problem because there is no consistence, on WebApp work and on the Meteor App do not work.
it would be better if it breaks in both cases

i received
[INFO:CONSOLE(0)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (0)

is your same problem ?

I tried also to set

App.accessRule('http://*');
App.accessRule('https://*');

in the mobile.config.js without solve. Mabe it is only a CORS problem ?
Also the Image file breaks in this way

Yeah same. End up not using pdf at all.

You can use inappbrowser for displaying pdf in mobile.

We already tried it, it do not work on local file served by /public folder,
but only on remote file.

I am not sure about your use case. But if you are using meteor the public folder would be on the webapp as well. you can give the full path to access the file on the server where your app is hosted

It’s a dangerous assumption that this is a good place to store uploaded files. The public folder is intended for application assets bundled as part of the deployment. On container-based deployments (including Galaxy), files uploaded to public are not protected over migrations to new containers (for example on updates), and will not even exist on other containers in a scale-out deployment.

1 Like

wait, wait,
please read the topic title, or the tag: this is a mobile application (Android)