3

This problem appeared when I update the ionic and cordova, $http can't normally work any more, always return null. in debug line apeared "04-28 16:06:29.756: W/SystemWebViewClient(16778): URL blocked by whitelist:"

4 Answers 4

8

This error happened after cordova update 5.0.0.

Like Santosh said, you just need add the plugin https://github.com/apache/cordova-plugin-whitelist.git to your app and everything will work. I was getting the same error and i fixed with this plugin.

You will need add the follow code to your webconfig file:

<allow-navigation href="http://yourDomain.com/*" />
6

With the updated version of cordova-android, you now need to include the cordova-whitelist-plugin.

https://github.com/apache/cordova-mobile-spec/tree/master/cordova-plugin-whitelist

Try adding that to your project

For example -

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

For more help read issue on https://github.com/driftyco/ionic/issues/3597

1

Use this command with new CLI:

ionic cordova plugin add cordova-plugin-whitelist

And in the config.xml no need to change the default settings which are:

<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

Here * represents anything so I solved my CORS problem using these settings.

Note:Don't forget to remove the platform after adding the plugin although it's added automatically there too but it's better to take precaution as you'll never know what might be the cause using

ionic cordova plugin save
ionic cordova platform remove android
ionic cordova platform remove ios

Then add again

ionic cordova platform add android
ionic cordova platform add ios
0

I had the same issue, just try adding whitelist plugin again. As it might be missing as happened with us. So try the following commands

For phonegap build:

phonegap plugin add cordova-plugin-whitelist

for Cordova :

cordova plugin add cordova-plugin-whitelist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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