Webkit messagehandlers postmessage Webkit messagehandlers postmessage The second one comes from the iOS simulator. bounds, configuration: config ) Finally, after adding my web view to the main one, here is my result, the first one is loaded from Safari. userContentController = contentController self.
Webkit github code#
When JavaScript code sends a message that specifically targets your message handler, WebKit calls your handler’s userContentController (_:didReceive:) method. Adopt the WKScriptMessageHandler protocol when your app needs a way to respond to JavaScript messages in the web view. messageHandler functions into your JavaScript code is pretty slick WebKit offers a powerful suite of tools for iOS developers to manipulate JavaScript directly inside a.
postMessage(data) to be defined in all frames in all WebView instances that use. The renderer constructor calls the WKUserContentController.AddScriptMessageHandler method to add a script message handler named invokeAction to the WKUserContentController object, which will cause the JavaScript function window.