Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap-Javascript sending cross-domain ajax request

Tags:

I'm using PhoneGap and JavaScript to produce an iPhone app. Is it possible to send a cross-domain AJAX (POST) request and download the response as HTML? (ex.: sign into yahoo mail and fetch new mails)

like image 554
Pharaz Fadaei Avatar asked Dec 17 '12 19:12

Pharaz Fadaei


People also ask

Can I send AJAX request to another domain?

Setting up a CORS policyBy default you are not allowed to make AJAX requests to another domain. Your browser applies the Same-origin policy as part of the web security model.

How do I make a cross domain AJAX request?

For a successful cross-domain communication, we need to use dataType “jsonp” in jquery ajax call. JSONP or “JSON with padding” is a complement to the base JSON data format which provides a method to request data from a server in a different domain, something prohibited by typical web browsers.

Does AJAX support cross domain?

You can allow Cross Domain Ajax calls to an application by just registering a new filter and then configure it to Allow-Origin : {your domain's} or you can use a wild card “*” to allow the calls from all domains.


1 Answers

Cordova/PhoneGap allow for whitelisting of domains. As long as the server you are requesting is in the whitelist.

like image 57
Chris Sobolewski Avatar answered Sep 25 '22 13:09

Chris Sobolewski