WKWebview v3.0.0

Hi Mike,

If our application already used cordova-plugin-wkwebview-engine will this be a drop in replacement or will we need to go through will all the changes mentioned in the announcement post?

Unfortunately, I did as this instructions, but the cors issue of xhr still occurred to me.

Hi! Yep, CORS need to be implemented correct on your server to work. The WKWebview Docs mention this

Hey, @mhartington, have you guys researched these concerns? Thanks!

I have tried to use the WKWebview plugin a few times already, and each time I found something else broken and had to revert back. Today I noticed that after the app goes into background mode it closes, meaning the next time you activate the app, it restarts from the splash screen. So I reverted back again, took off the plugin and added instead
<preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
and at least it works again. There so much hype about new things like Lazy Loading, Stencil, WKWebview, Ionic Cloud/Pro and so on, but they’re not complete or stable enough.

We installed WKWebview using the instructions on the ionic blog. We were wondering if there is a method to be 100% sure that we are now using WKWebview. Something that only triggers when using WKWebview and not when using UIWebview…

From the README of the decrepated repo:

An easy way to verify that WKWebView has been installed on iOS is to check if 
window.indexedDB exists. For example:

if (window.indexedDB) {
   console.log("I'm in WKWebView!");
} else {
   console.log("I'm in UIWebView");
}

Hey, sorry for the delay.

  • Is the server restricted to the app or can other running apps send requests to it?

The server is restricted the app that it is running in. Each iOS app runs in it’s own sandbox, so other apps cannot directly talk to one another

  • Is the server only listening on localhost or will it answer requests from the network?

The server is only listening to local host, so if you try to connect to it from an external network, it will fail.
This keeps the server safe and secure.

  • What happens if two or more apps using this plugin are installed on the same device? Will they all try to listen on the same port and fail?
    Nope, you can have to apps running the same server and it will work. Again, because they’re sandboxed, each one creates it’s own network instance, so they wont clobber each other.

This may or may not work. UIWebview kind of had indexDB, but it was very broken.

The best way to check and be sure is just look through your file system, or try logging out scroll events in your test.
WKWebview reports correct scroll events while UIWebview has a buggy reporting for it.

We were indeed in WKWebView :smiley:. Thanks!

2 Likes

Thanks! I think this should be added to the docs somewhere, as more people are likely to raise these questions.

Hi @mhartington,
Is this plugin increase the size of app?
Thanks a ton.

Nope it shouldn’t as wkwebview is a system library already present on the device.

1 Like

If you run the app from xcode you can see the native logging output “using ionic wkwebview” to confirm.

Hi, could you provide a piece of code to check if we are runing wkwebview on Android? I don’t understand how to log scroll events.

wkwebview is only for iOS

For app failing on simulator:
I’m facing the same issue. do you have a solution?
thanks

I updated all my stuff and it started to work.

Make sure you are using latest WKWebview plugin and latest cordova-ios platform.

Hi, Thank you :blush:

You saved me , thanks a lot =D