Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap on iPhone wont load external scripts

I am currently writing a simple application using PhoneGap (iOS) and running it in the simulator. The problem is that external URLs seem to refuse to load. For example using a CDN for jQuery

<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.7.min.js"></script>

Will not make $/jQuery available. The same problem is happening for weinre when trying to use it. Is there something I need to change to enable this to work?

like image 602
James Hughes Avatar asked Feb 22 '23 11:02

James Hughes


1 Answers

Have you added the domains of the external links to the ExternalHosts entry in PhoneGap.plist ?

There is a fairly new whitelisting system in PhoneGap that is causing a bit of confusion with external links

From - http://wiki.phonegap.com/ :

"Also, the latest code has the new white-list feature. If you are referencing external hosts, you will have to add the host in PhoneGap.plist under the "ExternalHosts" key. Wildcards are ok. So if you are connecting to "http://phonegap.com", you have to add "phonegap.com" to the list (or use the wildcard "*.phonegap.com" which will match subdomains as well)."

like image 55
Devgeeks Avatar answered Mar 03 '23 12:03

Devgeeks