Cordova mobile app, a lot of use of jquery Mobile, Datatjs (OData) and other JS framework, they follow the Internet standard HTTP cors, the app launched HTTP Get/post and other requests for extranet resources, jquery will secretly send an HTTP options request outside the network resources, after the external network server permission, jquery will formally send an HTTP get/post request. The
example is as follows:
Options/odata/applications/latest/app1/connections http/1.1 host:smp.springworks.info:8081 connection:keep-alive Access-control-request-method:post origin:file://user-agent:mozilla/5.0 (Linux; Android 5.0.2; REDMI Note 3 build/lrx22g;
WV) applewebkit/537.36 (khtml, like Gecko) version/4.0 chrome/45.0.2454.95 Mobile safari/537.36
Access-control-request-headers:accept, Authorization, Content-type, Dataserviceversion, maxdataserviceversion
Accept: */* accept-encoding:gzip, deflate accept-language:zh-cn,en-us;q=0.8 X-requested-with:com.mycompany.logon
http/1.1 OK access-control-allow-credentials:true access-control-allow-origin:file:// Access-control-allow-methods:post access-control-allow-headers:accept, Authorization, Content-type, Dataserviceversion, maxdataserviceversion access-control-max-age:3600 content-length:0 date:wed, Oct 21:54:36 G MT server:sap post/odata/applications/latest/app1/connections http/1.1 host:smp.springworks.info:8081 Connection:Keep-alive content-length:2 Accept:application/json maxdataserviceversion:3.0 origin:file://user-agent:mozilla/5.0 (Linux; Android 5.0.2; REDMI Note 3 build/lrx22g; WV) applewebkit/537.36 (khtml, like Gecko) version/4.0 chrome/45.0.2454.95 Mobile safari/537.36 dataserviceversion:1.0 A Uthorization:basic dg9ty2f0onrvbwnhda== Content-type:application/json accept-encoding:gzip, deflate Accept-Language
: zh-cn,en-us;q=0.8 x-requested-with:com.mycompany.logon http/1.1 201 Created Access-control-allow-credentials:true set-cookie:x-smp-sessidsso=b984633bcf2344f81a6f784362782724; path=/; HttpOnly set-cookie:x-smp-sessid=29b2310d0600349ccba294f7d7b851340121dbd6bd9a523ef08f1552cf25d566; path=/; HttpOnly set-cookie:x-sup-appcid=41fc7dba-7c5e-4577-9184-12b95e89536e; Expires=tue, 14-oct-2036 21:54:36 GMT; path=/set-cookie:x-smp-appcid=41fc7dba-7c5e-4577-9184-12b95e89536e; Expires=tue, 14-oct-2036 21:54:36 GMT; path=/dataserviceversion:1.0 date:wed, Oct 21:54:36 GMT LocatiOn:http://smp.springworks.info:8081/odata/applications/latest/app1/connections ('
41fc7dba-7c5e-4577-9184-12b95e89536e ') Content-type:application/json;charset=utf-8 transfer-encoding:chunked
Content-encoding:gzip vary:accept-encoding Server:sap
Reference:
Http://demos.jquerymobile.com/1.3.2/faq/how-configure-phonegap-cordova.html
Excerpt: The initial application document is loaded by the PHONEGAP application by a local file://URL. This means so if you want to pulled in pages from your company's remote server (phone home) You'll have the refer to them With absolute URLs to your server. Because your document originates from a file://URL, loading pages or assets from your remote server was considered a cross -domain request that can is blocked in certain scenarios.
HTTP cors Standard] (https://www.w3.org/TR/cors/)