Project configuration

Salesforce mobile SDK Cordova plugin version: 8.2.0.
Cordova ios: 5.1.1.
Type of application: Local

After login, I am getting below error.

cross origin requests are only supported for http XMLHttpRequest cannot load file:///private/var/containers/Bundle/Application/.....html due to access control checks

Cross error

Please help me to resolve the issue.
Aslo I tried cordova-plugin-wkwebview-file-xhr but still, I am getting the error.

As per Cordova-ios 6.0.0 official release note, they mention bellow point

_**Moved WKWebView support into Cordova-iOS and removed UIWebView code Due to this change, the cordova-plugin-wkwebview-engine plugin is obsolete and will not work with this release. If you have this plugin installed, it is safe to remove with Cordova plugin remove cordova-plugin-wkwebview-engine.

Additionaly, WKURLSchemeHandler support has been introduced with this release. **Using a custom scheme to serve your app content through fixes CORS issues that exist because of the strict security policies that WKWebView has applied to the file scheme. You can easily configure your Cordova project to use a custom scheme by setting the preference options scheme and hostname in the config.xml file.****_

So, If this is the solution then please can you provide the new salesforce mobile SDK Cordova plugin which supports Cordova ios 6.0.0.


Try to use Cordova-ios 6.0.0 or 6.1.0 and install following plugin from github

cordova plugin add https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix

It works fine for me.

| improve this answer | |
  • Thanks for your reply ...but the latest salesforce mobile SDK (8.2.0)only supports cordova-IOS 5.1.1. Can you suggest me how to use Cordova-ios 6.0.0 or 6.1.0 over salesforce mobile SDK. – subhendu Sep 2 at 16:49
  • I have added an instruction below to solve this problem for Cordova-ios:5.1.1. Let me know if this helps solve your problem. – user14158864 Sep 3 at 4:21
  • I already tried those steps but still getting the same error .please let me know if anything else I have to do apart from those steps. – subhendu Sep 3 at 10:33
  • I don't use Salesforce mobile SDK Cordova plugin. For me fixed "cross origin requests are only supported for http XMLHttpReques" error in other cases – user14158864 Sep 3 at 10:43
  • ok..please can you tell me how you load the HTML file. In my case, I am using angular js (1.6) Router to load the file – subhendu Sep 3 at 11:32

For Cordova-ios 5.1.1 you need to install 2 following plugins

cordova plugin add https://github.com/apache/cordova-plugin-wkwebview-engine.git#master
cordova plugin add https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix


you need to add following to your config.xml file

    <access origin="*" />
    <preference name="WKWebViewOnly" value="true" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.