Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Whitelist rejection in Phonegap

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?

like image 783
Neji Avatar asked May 29 '12 08:05

Neji


4 Answers

Notice: This answer only applies for PhoneGap version 1.x and below. From version 2.x onwards, whitelist configuration is done via cordova.xml.

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 add www.myhost.com as a new entry to ExternalHosts 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 to ExternalHosts 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?

like image 68
nhahtdh Avatar answered Nov 17 '22 19:11

nhahtdh


In PhoneGap 3.0, you need to edit config.xml in Project folder (note: not the www/config.xml)

<access origin="*" />
like image 45
Ivan Avatar answered Nov 17 '22 18:11

Ivan


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:

<access origin="*" />
like image 18
shawkinaw Avatar answered Nov 17 '22 19:11

shawkinaw


You can add this following code in Cordova.plist file:

<key>ExternalHosts</key>
       <array>
               <string>*.facebook.com</string>
       </array>

With *.facebook.com as the domain name, you can use two different sub-domains.

like image 8
Manish Agrawal Avatar answered Nov 17 '22 19:11

Manish Agrawal