Javascript not invoked
Reported by
thangadu...@gmail.com,
Jan 16 2017
|
||
Issue description
HI
I had a issue in webview after updated. But i solved the issue after removing the webview updates in the device (From kitkat to marshmallow).
In Android N, again I am facing the sameview.
The Problem is, I can't invoke or call endpoint url's (html page) javascript method.
for security reason i can't give the exact url.
Sample url -> https:////...index.html
webview.loadUrl("javascript: function CallingMethod() { window.alert('welcome') }"
and tried another approach as well
webview.loadUrl("javascript: function CallingMethod() { window.alert('welcome') } CallingMethod();");
After want to directly invoke this method.
Kindly check and do the needful.
Thanks in Adavance
,
Jan 26 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by paulmiller@chromium.org
, Jan 24 2017> I had a issue in webview after updated. But i solved the issue after removing the webview updates in the device (From kitkat to marshmallow). I don't understand. Is this part of your question? Did something stop working at a particular WebView version? > webview.loadUrl("javascript: function CallingMethod() { window.alert('welcome') }" That will define but not actually run your function. > webview.loadUrl("javascript: function CallingMethod() { window.alert('welcome') } CallingMethod();"); That will define and run your function. If it's not working, make sure that JS is enabled, and that you have a WebChromeClient configured to do something useful with alerts. By default, with an empty WebChromeClient, WebView will show the alert for you: webview.getSettings().setJavaScriptEnabled(true); webview.setWebChromeClient(new WebChromeClient()); Also, if you're going to be calling a JS function defined on the page you're loading, make sure the page is loaded before trying to call it (typically by using WebViewClient.onPageFinished).