Cordova iOS Cross origin requests are only supported for HTTP

ID : 274364

viewed : 29

Tags : ioscordovawhitelistios

Top 5 Answer for Cordova iOS Cross origin requests are only supported for HTTP

vote vote


Install this one plugin (cordova-ios 6+)

  cordova plugin add 

then set

  <preference name="AllowUntrustedCerts"  value="true" />   <preference name="InterceptRemoteRequests" value="all" />   <preference name="allowFileAccessFromFileURLs" value="true" />   <preference name="allowUniversalAccessFromFileURLs" value="true" /> 
vote vote


Install the following plugins:

cordova plugin add cordova-plugin-wkwebview-engine     cordova plugin add cordova-plugin-wkwebview-file-xhr     cordova plugin add 

Add to config.xml:

<platform name="ios">   ...    <preference name="WKWebViewOnly" value="true"/>   ...  </platform>  
vote vote


For Cordova iOS 6+ just need to install the following plugin.

cordova plugin add 

This plugin does not depend on any other additional plugins and does not require additional permissions.

vote vote


I had the same issue with my cordova project (actually Ionic v1) and I fix it with the following command:

cordova plugin add 

This will install a webserver that runs locally and the error should be gone after that. After you run that command, just run:

cordova prepare ios 

or remove all plugins and reinstall:

rm -rf plugins/ cordova platform add ios 

Make sure you have this in your config.xml:

<access origin="*" /> <feature name="CDVWKWebViewEngine">   <param name="ios-package" value="CDVWKWebViewEngine" /> </feature>  <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />  
vote vote


I had the same issue with my ionic v1 Cordova project. For me the solution was to migrate to capacitor, like this:

  • Start a New Ionic v1 project (% ionic start Bienchen blank --type ionic1)
  • Answer "yes" when the cli asked if to integrate "capacitor".
  • Checkout my Sources to the www-folder of the new Ionic v1 project
  • Build the project with capacitor (% ionic capacitor build iOS)

Keep in mind the the Cordova config.xml than is not longer used, instead configure in Xcode Project.

Top 3 video Explaining Cordova iOS Cross origin requests are only supported for HTTP