0
I’m having a problem using Swift webview, I noticed that some javascript codes inside the loaded page do not run. Example:
onclick="functionMuitoLegal()"
But if I do the same thing using React on the page to load, onclick works normally within the webview:
onclick={functionMuitoLegal}
Has anyone ever faced this problem? You know why it occurs so that I can get around it ?
The url loads normally and the prints of this code below are being displayed on the Xcode console:
override func loadView() {
    let preferences = WKPreferences()
    preferences.javaScriptEnabled = true
    preferences.javaScriptCanOpenWindowsAutomatically = true
    let webConfiguration = WKWebViewConfiguration()
    webConfiguration.preferences = preferences
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.navigationDelegate = self
    print("carrega delegate ")
    view = webView
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
  print("carregou página")
}