Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

WKWebView and Apache Cordova

with 18 comments

Webkit_LogoThe Good

WKWebView support will be coming in cordova-ios 4.0.0, tentatively scheduled for April 2015. You can however, alpha test the support by following this README.

Pluggable webviews are coming in cordova-ios 4.0.0, which in addition to the default UIWebView, you can include the wkwebview-engine plugin for WKWebView support (it will not be in there by default so as not to break your existing code). The default uiwebview-engine has also been pluginized as well, which allows scenarios where you can update it with bug fixes after a platform release, or substituting it as the default webview for wkwebview-engine in the future.

cordova-ios 4.0.0 is still a work in a progress, and the APIs are subject to change. Rest assured that all core plugins will be compatible before we release, and we’ll test a bunch of the top plugins from plugins.cordova.io as well.

The Bad

Unfortunately for the WKWebView in iOS 8, support for loading local files in the app bundle is not available (yet). The code has been patched in WebKit2, but the patch hasn’t been downstreamed into iOS yet. As of iOS 8.3 beta 2, the functionality is still not available. So, we’ve decide to use the embedded local web-server route. Because of this, the File core plugin and the Camera core plugin might not work yet (fixes are coming) — we have a solution that transforms file:/// references to the appropriate http://localhost routes.

The Ugly

So WKWebView is great right? Yup! But there are limitations to its behaviour as compared to UIWebView:

Help Test!

Instructions here. Please file issues and assign them to me. Thanks everyone 🙂

Written by shazron

March 3, 2015 at 1:48 am

Posted in Uncategorized

18 Responses

Subscribe to comments with RSS.

  1. Of course, lack of AppCache support shouldn’t really matter, right? 🙂

    Raymond Camden

    March 3, 2015 at 3:32 pm

    • Not to Cordova, it’s just a general WKWebView limitation…

      shazron

      March 25, 2015 at 10:55 pm

  2. I am authenticating my session on my external server by setting a cookie on the client browser. This cookie no longer seems to be sent from my app to my server. How does the embedded server handle cookies from the WKWebView to the external server?

    Jeremy

    March 21, 2015 at 9:21 am

    • It should still handle cookies (you just can’t delete them from any interface). Any deficiency you encounter would sadly be WKWebView’s fault, not sure of a workaround.

      shazron

      March 25, 2015 at 10:56 pm

  3. Is cordova-ios 4.0.0 still on track for an April release?

    benchun (@benchun)

    April 2, 2015 at 12:49 am

  4. Hey, any word on the fixes for the file core and camera plugins to work with http?

    Jeremy

    April 15, 2015 at 8:46 pm

  5. Hi, any news on the schedule for the cordova-ios 4.0.0 release?

    Atte

    May 18, 2015 at 9:04 am

  6. +1 on the value of the cordova-ios 4.0.0 release. I appreciate your work!

    Ryan

    June 26, 2015 at 1:27 pm

  7. Hi,

    Do you have any update on the release date? I did try the plugin with cordova ios4dev but my application does not get loaded! is there anything I can do to know why? nothing wrong in the logs!

    fadi al-katout

    July 8, 2015 at 3:45 pm

  8. Now that the local file bug is fixed in iOS9; is there a planned date for 4.0 release with wkwebview?

    AG

    August 18, 2015 at 4:47 am

  9. […] we missed the proposed deadline, by a […]

  10. […] get a sense for its need and history. Although the SDK has been updated and WKWebview is present it doesn’t appear to be a very easy fit for frameworks like Cordova just yet. Work still has to be done as it appears, but they’re getting […]

  11. […] pattern lately of breaking more and more Cordova/Hybrid compatibility in their new iOS releases, WkWebView in iOS8 and now Url’s with hash’swindow.location in iOS9. When Apple uses the slogan […]


Leave a comment