Skip to content Skip to sidebar Skip to footer

Ajax Calls Fail When Running Android Cordova App In Release Mode

AJAX calls fail when running the app in release mode on Android (works on iOS). This is the error (a warning really) I see in the Chrome Dev Tools: Provisional headers are shown Re

Solution 1:

Had exactly the same problem. $.ajax works fine on debug version. Release Version fails with status code 0. Issue was a week SSL certificate. I changed the https to http and then it worked in release too. See:

https://forum.ionicframework.com/t/cordova-plugin-whitelist-problem-only-in-release/43705/3

Solution 2:

From API side api developers need to allow cross origin headers.

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: CUSTOM_HEADERS);
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS);

Also when request come from cordova or using ajax, then there ajax request two call: first call is for options, in which api returns only allowed headers & methods after that second is actual api call which call api.

Post a Comment for "Ajax Calls Fail When Running Android Cordova App In Release Mode"