Cordova WKWebView Plugin

wkwebview

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 →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.