0

I am about to start developing my first PhoneGap application (iOS and Android). Had a doubt regarding how it works.

From my understanding

  1. It just loads up the index.html file
  2. from which the page is controlled by any javascript we write in it
  3. The JS will manipulate the DOM and give it an responsive application feel
  4. Data can be pushed or pulled from an outside server, via AJAX API calls

I was wondering if while attempting to make these AJAX calls, would there be the cross domain issue ? Or does it work completely differently.

Thanks.

4

2 回答 2

0

Thats basically how it works, webkit is quite forgiving when it comes to calling XML cross domain in my experience on both platforms. If you're really worried try to use JSON data.

于 2013-05-16T04:45:12.547 回答
0

The same origin policy does not apply to the file:// protocol. http://en.wikipedia.org/wiki/Same_origin_policy#Corner_cases_and_exceptions

PhoneGap apps imbed a web view which loads it local html files using the file:// protocol.So you can do cross domain XHR from PhoneGap apps.

于 2013-05-16T05:32:55.287 回答