Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CORS and phonegap apps

Do phonegap applications require any CORS changes (like setting Access-Control-Allow-Origin:*) to work? I have a restful API hosted on Heroku and was wondering whether I need to set this header in order for my phonegap application to call the service?

I was thinking that because the phonegap application isn't really hosted on a domain, then CORS isn't required and I won't get any cross domain issues?

It would be great if someone could explain to me why this is or isn't the case.

like image 755
jcm Avatar asked Jan 23 '14 00:01

jcm


People also ask

Is PhoneGap open source?

Apache Cordova (formerly PhoneGap) is a mobile application development framework created by Nitobi. Adobe Systems purchased Nitobi in 2011, rebranded it as PhoneGap, and later released an open-source version of the software called Apache Cordova.

What is app made from JavaScript and PhoneGap called?

Hybrid apps are developed using web technologies: HTML5, CSS and JavaScript, then put inside a native container such Adobe PhoneGap. These native containers run the web application code and package it into an app.

Who originally developed PhoneGap?

PhoneGap was originally developed by a company called Nitobi Software, which was acquired by Adobe in 2011. The technology was donated as an open source project to the Apache Software Foundation with the name Apache Cordova.

Is Cordova discontinued?

Effective immediately, App Center will no longer offer the option to create Apache Cordova apps through the portal, CLI or API. Starting April 1, 2022, the App Center service will no longer accept calls from the Cordova SDK.


1 Answers

PhoneGap you can just XHR directly to remote servers and it should "just work". Cross-domain policy does not apply to PhoneGap (for a variety of reasons, basically because your app is essentially running off the file:// URI on-device).

Please be aware that you will have to set up a whitelist for your apps to access these external domains. Please check this link:

http://docs.phonegap.com/en/1.8.0rc1/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide

like image 180
user3225827 Avatar answered Oct 26 '22 04:10

user3225827