Tar
Tar

Reputation: 9015

How to inject JavaScript to WebView whenever required?

This link shows how to inject JavaScript code to WebView object in Android. However it's available only once, via onPageFinished(webView,url), when the page is finished loading.

Is there a way (how ?) to keep that "injection" ability "forever", whenever necessary ?

Upvotes: 1

Views: 858

Answers (1)

ChristopheCVB
ChristopheCVB

Reputation: 7315

I use :

  mWebView.loadUrl("javascript:alert('hello')");

Upvotes: 4

Related Questions