New issue
Advanced search Search tips

Issue 681496 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

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

 
> 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).
Status: WontFix (was: Unconfirmed)

Sign in to add a comment