Regex Rookie
Regex Rookie

Reputation: 10662

How to programmatically select all WebView content?

Is there a way to programmatically select all WebView content?

I know how to put the WebView into "text selection mode". But that relies on the user to do the selection, manually.

If there is a way to programmatically select all WebView content, how do I do that?

Upvotes: 8

Views: 2068

Answers (3)

KnIfER
KnIfER

Reputation: 750

try mWebview.evaluateJavascript("document.execCommand('selectAll');",null);

Upvotes: 3

Swaroop
Swaroop

Reputation: 916

In Javascript you can iterate across all the "elements" and call .select() on each one of them. Nothing specific to Android though.

Upvotes: 1

Karsten
Karsten

Reputation: 1886

There is no way to select something in WebView programmatically.

Upvotes: 2

Related Questions