Performance is a critical aspect of mobile app development and the embedded platform web view is a significant contributing factor to the performance of any hybrid mobile app.
Since late 2015, hybrid app developers targeting iOS have been able to include the Apache Cordova team’s cordova-plugin-wkwebview-engine plugin in order to benefit from the much-improved performance of WKWebView over the default UIWebView.
A tradeoff using WKWebView is that it blocks XHR requests that attempt to load resources from the application bundle using the file:// protocol. Notably, this constraint breaks use of the RequireJS text plugin for loading application resources such as templates.
The reason for this is that even though the Cordova application's starting page is loaded from the device file system, WKWebView treats XHR requests to file:// URLs as cross origin requests. Since there is no way to specify the Access-Control-Allow-Origin response header for these requests, these cross origin requests fail.
While the cordova-plugin-wkwebview-file-xhr plugin allows the application's local resources to be loaded via file:// XHR requests, there is another XHR-related CORS issue that application developers might face when using WKWebView, which is not addressed by this plugin. Since the application's starting page is loaded from the device's file system, all XHR requests to remote endpoints are considered cross origin. For such requests, WKWebView specifies "null" as the value of the Origin header, however many endpoints are configured to disallow requests from the null origin.
If your REST endpoints are open or accepting of null origins, the cordova-plugin-wkwebview-file-xhr Cordova plugin makes it possible for you to benefit from the higher performance of the WKWebView in your Cordova-based hybrid mobile applications on iOS.