1 Reply Latest reply on Sep 20, 2016 4:34 PM by risingj

    WKWebview and Phonegap Build: Is communication between index.js and WKWebView even possible?

    donr24351798 Level 1

      I'm using Phonegap Build to generate native code primarily for iOS.  With Phonegap using UIWebView I had no problem coding index.js to listen for a loadstop event and call executescript to execute javascript in the webview and return the results to index.js where I could do whatever I needed.

       

      But UIWebView is dog-slow, so I've been trying to get WKWebView to work via the cordova-plugin-wkwebview-engine plug-in.

       

      I can get the WKWebview to open my URL, and it is blazing fast compared to UIWebView, but after days of searching and experimentation I have been unable to find any way to detect loadstop (or equivalent), nor have I found any way to execute a script in WKWebView from index.js.

       

      I would probably be happy with ANY method to communicate between index.js and WKWebView.  Is there a process similar to executescript after loadstop event, even if it is async? Is there some type of messaging capability? 

       

      I'd love to see some code examples for index.js.

       

      I'm beginning to think that I'm going to have to break down and resort to learning native code to make this happen. I sure hope not because Phonegap Build has worked fine for me thus far.

       

      Has anyone had any luck with this?