Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 520
Regex Rookie Avatar asked Mar 07 '11 21:03

Regex Rookie


3 Answers

There is no way to select something in WebView programmatically.

like image 56
Karsten Avatar answered Nov 12 '22 12:11

Karsten


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

like image 37
KnIfER Avatar answered Nov 12 '22 14:11

KnIfER


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

like image 1
Swaroop Avatar answered Nov 12 '22 12:11

Swaroop