I have a JS file that has functions to search a document for substrings.
I want to access functions inside this file by passing parameters to it (the search keyword).
I know we can use .loadUrl("javascript:~~~~~) but I'm not clear on how to do it using multiple functions.
Anyone who can point me in the right direction?
Thanks!
You can try this.
webview.getSettings().setJavaScriptEnabled(true);  
webview.setWebViewClient(new WebViewClient() {  
  @Override  
  public void onPageFinished(WebView view, String url){
    webview.loadUrl("javascript:(function() { " +  
    "var script=document.createElement('script');" +
    "script.type='text/javascript';script.src=" + jsFileURL + ";" +
    "script.onload=function("+queryString+"){//it can be your search function};"
    "document.getElementsByTagName('head').item(0).appendChild(script);"+  
    "})()");  
  }  
});  
webview.loadUrl("http://SOMEURL");If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With