PhoneGap apps must use domain whitelisting to access external resources
If your PhoneGap application loads some external content via AJAX, keep in mind that you have to include domain whitelisting in your config.xml
.
PhoneGap is very strange about this, from version to version and from platform to platform, and sometimes allows you to access external resources without domain whitelisting (I had that issue, that this worked on Android 2.x, but failed on 4.x). So, to be sure, add it to every new project.
In general, you’re whitelisting your resoruce by adding following line to your config.xml
:
<access origin="http://google.com" />
There are some options and switches and things you have to consider. You’ll find details about this in below mentioned resources.
External resorces:
- PhoneGap Build
config.xml
documentation (end of page, “Access Element” section), - Domain Whitelist Guide in version 2.9.0 of PhoneGap docs,
- these two Stack Overflow answers.