Unable to set header in ionic webview for cookies Access-Control-Allow-Origin

We have build an app with ionic framework and jquery. Every thing is working fine in chrome browser. But when we install the app in android device our ajax headers are not getting set for the cookies. While doing research for the resolution we found about crosswalk in ionic we added it as well but the behaviour is still same. Tried many things like change in

Change in meta tags
<meta http-equiv="Content-Security-Policy" content="default-src *; connect-src http://localhost:* ws:blo: http://192.168.2.2:* file:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">

Modified in ajax calls as well like this.

jQuery.ajaxPrefilter(function (options) {
options.crossDomain = {
crossDomain: true
};
options.xhrFields = {
withCredentials: true
};
});

Tried patch change in mainactivity.java as well but the behaviour remains the same.

Modified config.xml as below

<allow-navigation href=*" />
<allow-intent href=*" /> 

Tried with JQuery.supports.cors = true.

I know we can use localstorage instead of $.cookies of jquery but i cant.

Can any one have the same issue. Please suggest if having solution for the problem.

may I ask … why Jquery?

1 Like

Thanks for your reply, Ya sure you may ask, Our web application is running on this old framework and webapi is integrated with jquery so we should have to utilize the same code for our app as well, So we can not made any changes in back end.