Archive for June 20, 2018

Wednesday, June 20, 2018 [Tweets] [Favorites]

WebView and UIWebView Deprecated in Favor of WKWebView

Brady Eidson:

I hope most of you have heard the news by now, but UIWebView has been formally deprecrated.

That means it is going away altogether in a future release.

Please start adopting WKWebView now, and please ping me directly with any issues that arise.

(Same goes for WebView on Mac)

The separate process architecture is nice, but this is going to be a rough transition. It looks like WKWebView is still missing tons of features from WebView (Web archives, DOM, customized loading and display, probably more that I haven’t discovered yet). The limitations are so severe that I bet a lot of apps haven’t even looked much into switching. Other features will be possible to port, but the API is very different, and in many cases you’ll need to switch from Swift/Objective-C to JavaScript. I was expecting to see massive improvements to WKWebView before WebView was deprecated, but that doesn’t seem to be happening.

See also: What’s New in Safari and WebKit.

Previously: WKWebView Workarounds, WKWebView, Sandboxing, and Searching, WKWebView.

Update (2018-06-20): The WWDC session has no useful information about switching to WKWebView, and the presenter implies that it’s easy.

Steve Harris:

As @mjtsai the inability to create web archives is a problem for me (and adding iOS support would be great), while printing / saving PDFs doesn’t work at all on Mac

Matt Curtis:

On the subject, is there a way to invoke copy from a WKWebView while preserving rich text? I tried a while back and it doesn’t seem to work using the usual UIResponder methods.

Isaiah:

My main income is Stack for Rapidweaver. The vast majority of the UI handled by manipulating the DOM directly.

That is not possible in a WKWebView.

If WebView is removed my business will die and strand thousand of customers.

the issue is that they’ve cut off most of the fast APIs.

this was, i’m sure, done to improve security and avoid content policy injection.

unfortunately it really limits the utility of the view.

it’s basically just a web page viewer now.

Update (2018-06-23): See also: Core Intuition.

Update (2018-06-24): David Dunham:

I tried using it but got random crashes and went back to UIWebView.

Daniel Jalkut:

We who rely upon WebView DOM manipulation really have our work cut out for us. We have to at least file the bugs with Apple and hope for accommodations where we need them.

Update (2018-08-01): Howard Oakley:

When WebViews are lost from macOS, a great many older apps will still expect to find them, and you should expect their behaviour to be untoward at least. I suspect that will kill far more apps than any future requirement for them to be 64-bit. And there’s no easy way to discover which apps are dependent on WebView.

Update (2018-08-10): Shazron Abdullah:

There are many limitations 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
  2. Can’t delete cookies. This is/was a WebKit bug (2015), we need to test for the iOS 11/12. See CB-11297
  3. Can’t execute JavaScript code in the background. There are several issues related to this. See 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
  5. Migration of localStorage from UIWebView. There is a migration plugin available. See CB-11974
  6. iframes will not be supported any longer (they are now CORS restricted in WKWebView), and may be partially or completely broken. This may lead to incompatibilities with the same code in other Cordova platforms.
  7. Known issues with WKWebView on iOS pre-11 which will be deprecated and dropped in a future Cordova release

There are several bugs that need to be resolved as well. The full list here: https://s.apache.org/QfsF

Update (2018-11-26): See also: Core Intuition.