Search code examples
jsonjquerycordovajquery-mobilejsonp

phonegap app ERROR whitelist rejection: url='http://xyz.com'


Below is my JSON code

$.getJSON("http://xyz.com",function(result){
    alert(result);
]});

I get this error whitelist rejection: url='http://xyz.com' ON IPHONE


Solution

  • In cordova/phonegap all external URLs are blocked by default. To change this, you have to add the url in question to the whitelist exception in Cordova.plist (XCode).

    whitelist exception for one URL

    Alternatively, you could add a * wildcard to allow all domains as shown below.

    whitelist exception for all external urls