window.webkit.messageHandlers provides null on ios 15, however once I set
config.limitsNavigationsToAppBoundDomains = true;
it really works correctly.
However I do not wish to prohibit my WkWebView to sure domains.
Code –
let config = WKWebViewConfiguration()
config.preferences.javaScriptEnabled = true
let userContentController = WKUserContentController()
userContentController.add(WKSMH, title: "print")
userContentController.add(WKSMH, title: "push-subscribe")
userContentController.add(WKSMH, title: "push-permission-request")
userContentController.add(WKSMH, title: "push-permission-state")
userContentController.add(WKSMH, title: "setUserAttribute")
config.userContentController = userContentController
if #accessible(iOS 14, *) {
config.limitsNavigationsToAppBoundDomains = true;
}
config.preferences.javaScriptCanOpenWindowsAutomatically = true
config.allowsInlineMediaPlayback = true
config.preferences.setValue(true, forKey: "standalone")
let webView = WKWebView(body: calcWebviewFrame(webviewView: container, toolbarView: nil), configuration: config)
Is there any approach to make use of messageHandlers aside from utilizing config.limitsNavigationsToAppBoundDomains = true
?