You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/08 07:49:52 UTC

[GitHub] NiklasMerz commented on a change in pull request #867: [BLOG POST] - The Future of the iOS WebView in Apache Cordova

NiklasMerz commented on a change in pull request #867: [BLOG POST] - The Future of the iOS WebView in Apache Cordova
URL: https://github.com/apache/cordova-docs/pull/867#discussion_r208486492
 
 

 ##########
 File path: www/_posts/2018-08-01-future-cordova-ios-webview.md
 ##########
 @@ -0,0 +1,70 @@
+---
+layout: post
+author:
+    name: Shazron Abdullah
+    url: https://twitter.com/shazron
+title:  "The Future of the iOS WebView in Apache Cordova"
+categories: news
+tags: cordova-ios uiwebview wkwebview webview roadmap
+---
+
+With the announcement of the iOS 12 beta SDK at Appleā€™s WWDC 2018, came the news that UIWebView, the webview originally bundled with the first iOS SDK, has been [deprecated](https://developer.apple.com/documentation/uikit/uiwebview). What this means for iOS developers is that sometime in the future, Apple will remove UIWebView from their SDK, and developers should migrate to using the WKWebView component starting right now.
+
+## WebView Engine Plugins
+
+Cordova iOS, starting with version 4, has anticipated this by moving the webview that is used by the platform into a plugin. The default webview that is used is still UIWebView, but you had the option to use WKWebView instead, with the [cordova-plugin-wkwebview-engine](https://github.com/apache/cordova-plugin-wkwebview-engine) plugin. Both the UIWebView and WKWebView webviews are plugins themselves, with the former included in the cordova-ios platform.
+
+![Figure 1]({{ site.baseurl }}/static/img/blog/2018/arch-webview-engine.png)
+
+## Cordova iOS 5 with WKWebView
+
+Starting with Cordova iOS version 5, which is a planned upcoming release, we will ship both webview plugins with the cordova-ios platform, to enable developers to test and transition users to the new WKWebView component. Cordova iOS 5 will ship with a bridge webview plugin that can switch usage of the webview plugin used at runtime. Previously, you could only choose which webview you would use at build time.
+
+![Figure 2]({{ site.baseurl }}/static/img/blog/2018/bridge-webview-engine.png)
+
+<!--more-->
+
+## Migration and Transition using the Bridge WebView Plugin
+
+The developer can switch the webview used by setting a preference, that will be read at runtime when the app starts. Developers can transition users to the new WKWebView by user choice, in their app settings -- or randomly perhaps as an A/B test. This will give the developer and their users a chance to try out the new component, and they can back out and use UIWebView if there are any problems, without needing a new app release. This is intended to be used for testing and migration purposes only -- developers should aim to support only WKWebView functionality going forward.
+
+## Cordova iOS Future Release, WKWebView only
+
+When UIWebView support has been removed in a future iOS SDK, we will aim to release a future Cordova iOS version, which will remove UIWebView support, and WKWebView will then be the default webview engine.
+
+| Cordova iOS 4 >>> | Cordova iOS 5 >>> | Cordova iOS Future Release |
+|-------------------|-------------------|---------------|
+|  | UIWebView deprecated | UIWebView removed |
+|  | WKWebView Engine Plugin Integrated Into Platform | WKWebView Engine Plugin only |
+|  | Bridge WebView Plugin Added | Bridge WebView Plugin Removed |
+
+
+## Limitations of WKWebView
+
+There are [many limitations](https://mjtsai.com/blog/2018/06/20/webview-and-uiwebview-deprecated-in-favor-of-wkwebview/) of WKWebview, especially if you were using UIWebView previously. The limitations are:
+
+1. Cookies don't persist. This is a WebKit bug, but someone has
+created a plugin for a workaround. See
+[CB-12074](https://issues.apache.org/jira/browse/CB-12074)
+2. Can't delete cookies. This is/was a WebKit bug (2015), we need to test
+for the iOS 11/12. See [CB-11297](https://issues.apache.org/jira/browse/CB-11297)
+3. Can't execute JavaScript code in the background. There are several
+issues related to this. See
+[CB-12815](https://issues.apache.org/jira/browse/CB-12815)
+4. XmlHttpRequests don't work, because of Cross-Origin Resource
+Sharing issue (CORS). There is a workaround plugin created by Oracle
+(UPL licensed, which is Apache-2.0 compatible). See
+[CB-10143](https://issues.apache.org/jira/browse/CB-10143)
+5. Migration of localStorage from UIWebView. There is a migration
+plugin available. See [CB-11974](https://issues.apache.org/jira/browse/CB-11974)
+
 
 Review comment:
   Should we add a note about iframes that (may) break?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org