1

I have been looking around for more than 4 hours but I can't find the problem. I'm building an app with ionic and when I run it with ionic serve everything works.

When I try to run it on my android device (galaxy s3) I keep getting return status 0 for every request I make.

I have added the whitelist plugin and added the <access origin="*"/> <allow-navigation href="*"/> To my config.xml

On my server I see that the request is not even reaching so I dont think its a CORS problem.

i have also added <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> to my index.html but still all looks the same.

Anyone know what the problem is?

BTW I'm using satellizer as an external package and it sends the requests fine.

1 Answer 1

1

you need to set some Content-Security-Policy meta tag in your index.html

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">

and you have to check this plugin which Controls which URLs the WebView itself can be navigated to:

https://github.com/apache/cordova-plugin-whitelist

and in the Cordova config.xml try to add this line

<access origin="*" subdomains="true"/>

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.