I'm new to mobile development. I'm using Phonegap/Cordova to create a cross-platform app. My code works well on Android but when I'm porting it to iPhone it's showing an error:
[143:2003] ERROR whitelist rejection: url="abc"
Now can I overcome this problem?
You have to add allowed URLs into PhoneGap.plist's (or Cordova.plist) ExternalHosts array.
For example, if you want to allow access to this URL
http://www.myhost.com/path/file
, then addwww.myhost.com
as a new entry toExternalHosts
array.If you want to allow access to content on all the subdomain of Google (e.g.
maps.google.com
,mails.google.com
), you can add*.google.com
as a new entry toExternalHosts
array.I am not sure why you get "abc" in the link, though. Do you have "abc" as a link to anything? Is it URI fragment?
In PhoneGap 3.0, you need to edit
www/config.xml
, and add/edit<access>
tags. For example, if you want to allow everything, change the tag to:You will have to Domain Whitelist so you can access outside domains such as http://google.com.
In iOS (Cordova > 3.0.0), the whitelisting rules are found in
AppName/config.xml
and declared with the element<access origin="..." />
You can also use wildcards to declare domains. For example, to allow access to all subdomains and TLDs (.com, .net, etc) of Google, use
*.google.*
Reference: Domain Whitelist Guide
In PhoneGap 3.0, you need to edit config.xml in Project folder (note: not the www/config.xml)
You can add this following code in Cordova.plist file:
With
*.facebook.com
as the domain name, you can use two different sub-domains.This is because phonegap won't take external urls .For phonegap older versions below
2.x
we need to set url incordova.plist
like this.ex:
*.google.co.in
(u can put your url after *. this) andOpenAllWhitelistURLsInWebView
---to ---YES
.