Nativescript: WKWebView plugin to hook into webView

Created on 22 Dec 2015  路  17Comments  路  Source: NativeScript/NativeScript

@tjvantoll "The web view module indeed uses UIWebView https://github.com/NativeScript/NativeScript/blob/e458a94191ea593e2a940c3610e7c9570aac1740/ui/web-view/web-view.ios.ts#L12 I don鈥檛 think there are any plans to switch to WKWebView at the moment. You鈥檙e welcome to file an issue. This would be a good candidate for a plugin"

I hear the hype about WKWebView and I'm sold, I am moving from cordova and it's such a bummer that there is no WKWebView :-(


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

backlog feature

Most helpful comment

Who cares about iOS 7 ?? People that also support IE 5 ?

All 17 comments

@vbresults The reason it uses UIWebView is because of compatibility. WKWebView is iOS 8 and greater. NativeScript supports iOS 7. So unfortunately they have to program nativescript using what works on ALL the platforms.

Its time to move to ios 8 above?

Who cares about iOS 7 ?? People that also support IE 5 ?

We are currently discussing the matter with the iOS 7 support. It will be stopped soon, so just stay tuned!

That is good news

@N3ll you know rather than dropping ios 7 support; we could set it up so that it uses UIWebView on < 8 and WKWebView >= 8.
The code just needs to detect which platform it is on, then create the proper WebView. The app consuming the webview doesn't need to know about the underlying implementation.

@NathanaelA I discovered in my Cordova project that WK on iOS 8 has the perplexing limitation of not being able to set a custom user agent. WK.customUserAgent and updating NSUserDefaults do nothing.

Seems the iOS 9 implementation is more solid all around, maybe this was intentional. @N3ll I second Nathan's idea with two changes -- WK default on iOS >= 9 and/or option to pick implementation.

@vbresults Hmm, I wonder if this is something caused by cordova, or if this is something that is a bug in WKWebBrowser on iOS.

@N3ll @hshristov If I updated the NativeScript core code to have the ability to use UIWebView <= 7 and WKWebVeiw => 8 would this be a patch that would be accepted; or would it be better for me to just create a WKWebView plugin?

@NathanaelA It's definitely the WK in iOS 8. I also confirmed by going to the iPhone dev IRC and asking.

So was WKWebView implemented in NativeScript?

Only 3% of iOS users are on iOS 7 or below. https://developer.apple.com/support/app-store/

@PierBover It wasn't, but I have been able to implement it successfully in a private plugin (and unfortunately, for the time being it needs to remain private, but if that changes I'll post an update).

WKWebView should only be implemented for iOS 9 or newer. The iOS 8 implementation (by Apple) is incomplete, some documented features simply don't work. On iOS 9 it's perfect, zero problems.

On iOS 9 it's perfect, zero problems.

I beg to differ... but the most annoying ones are related to the file:// protocol.

I am seeing memory leaks with UIWebView in our NativeScript project.. and a quick look on stackoverflow, looks like many others are experiencing this as well and recommend switching to WKWebView. Lets go to WKWebView!

It looks like this is done and included in NativeScript 3.4.0.

Shouldn't it be mentioned in the CHANGELOG?

@davidsandoz Yes, it should've been in the changelog.
It's a breaking change for us.

Was this page helpful?
0 / 5 - 0 ratings