Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In general, PhoneGap applications do not suffer from cross-domain security restrictions once they are deployed to a mobile device. The reasons for this are different depending on which platform you are developing for, but for iPhone, it is because the your local PhoneGap assets are loaded into the browser on the iPhone using the <code>file:///</code> URI; this allows you to get around the cross-domain security restriction. If you are creating a regular web site that is being hosted on a server, then you <em>are</em> restricted by this security policy. It is one of the benefits of creating PhoneGap applications.</p> <ol> <li><p>I am not 100% familiar with Sencha, but you can use whatever framework on top of the basic XMLHttpRequest object to do cross-domain communication in PhoneGap. Be it Sencha, jQuery, xui, MooTools, etc.</p></li> <li><p>For testing PhoneGap applications, I usually use a combination of my desktop browsers and some extra tooling to help me. In your case, if you load your PhoneGap application locally on your computer into a browser like Safari (which allows you to make XHRs off the <code>file:///</code> URI), you won't see the cross-domain problems. Safari is one of the few browsers that allows you to do this. Alternatively, you can use a proxy on your local computer and have your local web server make the network requests and proxy them back to your application. I tend to use an awesome tool called <a href="http://github.com/alunny/sleight">sleight</a>, which is a <a href="http://www.nodejs.org">node.js</a> web server that will reverse-proxy requests to a target external domain if the server can't find the requested asset locally on your computer. I'll try to lay out an example use of sleight for you:</p> <ul> <li>Let's assume your PhoneGap application assets are located under ~/src/www, with the app being in index.html</li> <li>Also assuming you want to access the abc.com domain from your PhoneGap app</li> </ul></li> </ol> <p>You would use sleight like this:</p> <pre><code>$ cd ~/src/www $ sleight target=abc.com </code></pre> <p>Now you have a local web server running that serves up all content under your www directory. From your index.html page now you can dispatch XHRs to <a href="http://abc.om/app/a3/">http://abc.om/app/a3/</a>, and sleight will proxy those back to you. So you can point your browser to <a href="http://localhost:8088/index.html">http://localhost:8088/index.html</a> and you'll get your PhoneGap app's index.html.</p> <p>Sleight is an awesome tool for PhoneGap development as it allows you to test your PhoneGap apps on-the-go locally on your computer.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload