04-28 16:06:29.756: W/SystemWebViewClient(16778): URL blocked by whitelist:

家住魔仙堡 提交于 2019-12-13 06:59:37

问题


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


回答1:


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



回答2:


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




回答3:


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


来源:https://stackoverflow.com/questions/29913871/04-28-160629-756-w-systemwebviewclient16778-url-blocked-by-whitelist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!