Great work by the Ionic folks:
One of our awesome engineers has been working hard to bring
WKWebView
to Ionic apps and is working to bring the new plugin into Cordova! The new plugin will work with both Ionic V1 and Ionic V2 apps. In fact, it should work with any iOS Cordova build!
That is great news as WKWebView
really is a big deal for Hybrid Development.
It’s not included in Ionic by default, but comes as a plugin. Install it with this command:
ionic plugin add https://github.com/driftyco/cordova-plugin-wkwebview-engine.git --save
And then add this small change to your config.xml
:
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
You can use feature detection in your JS to differentiate between UIWebView
andWKWebView
:
if (window.indexedDB) {
console.log("I'm in WKWebView!");
} else {
console.log("I'm in UIWebView");
}
Cordova iOS Performance Improvements: Drop-in Speed with WKWebView →