Reputation: 280
I am trying to write a simple phonegap + jqm app that gets a page from remote server.
$.mobile.loadPage("http://mydomain.com/Mobile/MyPage.aspx")
.done(function () { alert('done'); })
.fail(function () { alert('fail'); });
});
I set the following options:
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
Added the following header:
Access-Control-Allow-Origin:*
Everything works fine when I try it in desktop browsers (ff/chrome/safari) but it doesnt work on my iphone or in the iphone simulator.
Any ideas?
Upvotes: 2
Views: 2469
Reputation: 280
Ok it turned out to be something silly: For cross domain request to work in iPhone (using phonegap and jquery mobile) you have to do the following: In xCode: Navigate to [projectName] -> Support Files -> phonegap.plist Under External Hosts add a new string with the value * Or add your exact domain
Upvotes: 3