How about Cross Domain Policy and Phonegap native app?

1,865 views
Skip to first unread message

Wael Ammar

unread,
Feb 7, 2011, 4:45:10 PM2/7/11
to phonegap
I have to made a jee app server and use phonegap to call the servlet
with XmlHttpRequest.

Does it cause some prob with the cross domain?

Thank

Simon MacDonald

unread,
Feb 7, 2011, 5:13:12 PM2/7/11
to phon...@googlegroups.com
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. Ergo you can do cross domain XHR from PhoneGap
apps.

Simon Mac Donald
http://hi.im/simonmacdonald

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

Isaac Zepeda

unread,
Feb 8, 2011, 12:44:25 PM2/8/11
to phonegap
wow, it also includes jQuery $.ajax() calls?

Regards,

On Feb 7, 3:13 pm, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> The same origin policy does not apply to the file:// protocol.
>
> http://en.wikipedia.org/wiki/Same_origin_policy#Corner_cases_and_exce...
>
> PhoneGap apps imbed a web view which loads it local html files using
> the file:// protocol.  Ergo you can do cross domain XHR from PhoneGap
> apps.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald

Simon MacDonald

unread,
Feb 8, 2011, 2:47:48 PM2/8/11
to phon...@googlegroups.com
As long as the web page is loaded via the file:// protocol the same
domain policy does not apply.

Isaac Zepeda

unread,
Feb 8, 2011, 3:29:33 PM2/8/11
to phonegap
my API is on http://myapi.com.mx/

I made an AJAX GET and POST to that url and it worked :)

thanks

On Feb 8, 12:47 pm, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> As long as the web page is loaded via the file:// protocol the same
> domain policy does not apply.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
Reply all
Reply to author
Forward
0 new messages