Downloaded files denied Cordova

create an app on cordova and I'm using Framework7. In this application, consult a web server that returns some data to me, including a link to download a pdf material, but I'm getting an error message because I don't have permission to download it includes the website address on the access source at config.xml.

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/" />

I have already followed several recommendations from other forums, but nothing works. I always receive the following message: net :: ERR_FAILED (https://www.mysite.com.br/download/myname.pdf)

Could someone help me solve this problem that I have been facing for 2 months.

thanks

1 answer

  • answered 2020-04-02 15:24 Federico Massi

    You can try to solve by creating a more general rule as:

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

    and a Content Security Policy as

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' mysite.com.br">
    

    Take care on the position of files (.htaccess rewrite rules could make you have a hard day ifyou don't check them). I'm quite sure you just check the presence of external class on your link in HTML, isn't it?