I created a HTML5 website with jQuery and jQueryMobile.
If I run it in the browser, everything works fine.
When I deploy it to the iPhone Simulator via Phonegap, it won’t find the jQuery object ($) which I included like this:
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
console.log($); // undefined
If I modify the src attribute, so that my app uses a local copy of jQuery, the jQuery objects exists:
<script src="lib/jquery.js"></script>
console.log($); // works
BUT then I noticed that none of my Ajax calls within my app work.
So, I assume that my iPhone app refuses HTTP connections to remote hosts.
How can I fix this?
Update: I checked the URL where my app is deployed within the iPhone app and it looks like this:
file:///Users/mobile/Library/Application Support/iPhone Simulator/5.1/Applications/9767E436-B93422-5423-5HLD-1680170C8AC5/MyApp.app/www/index.html
You need to specify which hosts you allow to connect to in the Cordova.plist
This feature is called Whitelist and avoids your app to connect to servers you don’t want to