korovaisdead
korovaisdead

Reputation: 6341

webView.evaluateJavascript. Doesn't want to execute.

Wrote some renderer for Android webView. Tryin' to call some javascript like this:

if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                this.Control.EvaluateJavascript(@"javascript: alert('asdasd');", new ValueCallback(() => { }));
            }
            else
            {
                this.Control.LoadUrl(@"javascript:alert('asdasd');");
            }

Before it I setted

this.Control.Settings.JavaScriptEnabled = true;

And there is no reaction. I can't see neither alert no any action in ValueCallback class. What I'm doing wrong?

Upvotes: 5

Views: 2294

Answers (1)

Benoit Jadinon
Benoit Jadinon

Reputation: 1161

add this :

Control.SetWebChromeClient(new WebChromeClient());

it'll work.

Upvotes: 2

Related Questions