Android Calling JavaScript functions in WebView

前端 未结 7 612
夕颜
夕颜 2020-11-22 04:14

I am trying to call some javascript functions sitting in an html page running inside an android webview. Pretty simple what the code

相关标签:
7条回答
  • 2020-11-22 05:05

    From kitkat onwards use evaluateJavascript method instead loadUrl to call the javascript functions like below

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
            webView.evaluateJavascript("enable();", null);
        } else {
            webView.loadUrl("javascript:enable();");
        }
    
    0 讨论(0)
提交回复
热议问题