Cordova iOS Cross origin requests are only supported for HTTP

Sven van de Scheur picture Sven van de Scheur · Apr 6, 2016 · Viewed 7.4k times · Source

I'm building an iOS app and recently upgraded cordova-ios to 4.1.0 and started using: cordova-plugin-wkwebview-engine.

The problem is that now I get the error message Cross origin requests are only supported for HTTP while trying to load dependencies, so the app won't start.

It's trying to load systemjs dependencies over file://, but I included in my config.js.

I have no clue how to fix this. Does anyone have experience with this bevaviour?

cordova version: 6.1,0 cordova ios version: 4.1.0

related config.xml bit:

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

<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

Answer

Avinash Tribhuvan picture Avinash Tribhuvan · May 25, 2020

Install the following plugins:

cordova plugin add cordova-plugin-wkwebview-engine    
cordova plugin add cordova-plugin-wkwebview-file-xhr    
cordova plugin add https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix

Add to config.xml:

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