Downloaded files denied

Hello, build an application in cordova, and I’m using Framework7, in this application I consult a webserver that returns me some data including a link to download a pdf material, but I’m getting an error message because I don’t have permission to download, includes the address of the site in access origin inside config.xml, and I followed several recommendations from other forums but nothing worked, could someone help me to solve this problem that I have been facing for 2 months.

Thanks

You probably need this: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist

Followed as a guide but without success, I have the plugin installed and followed as recommended in the link above, but it doesn’t work.

do I need some code snippet to download this or should the link only work?

I currently get from the webservice so

https://www.mysite.com.br/download/nomearquivo.pdf

I have the cordova-plugin-whitelist plugin installed and in config.xml I configured the following

<access origin = "https://www.mysite.com.br/download/" />
<allow-intent href = "https://www.mysite.com.br/download/" /> 

do I need anything else?

Not sure, but I feel they need a trailing *. Worth checking.

Try with the * at the end of the URL.

<access origin = "https://www.mysite.com.br/download/*" />
<allow-intent href = "https://www.mysite.com.br/download/*" />

Can you please send code which you used for download?

If you store data into persistent storage, then on android version you have to ask permission before download file.

For that, you have to use cordova-plugin-permission plugin to ask permission from user

1 Like