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)
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.
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.
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.
Cordova/PhoneGap allow for whitelisting of domains. As long as the server you are requesting is in the whitelist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With