0

I have a WebViewClient that opens in a dialog which i can capture when the URL changes, but on certain URL's I would like to replace certain text but I cant seem to figure out how to get the text of the current webpage that has been loaded so I can search and replace that text.

Brad Wickwire
  • 1,093
  • 4
  • 16
  • 29

1 Answers1

-1

Looks like there is already a question about getting the HTML code from a WebView. Please take a look at that: Is it possible to get the HTML code from WebView (Main tutorial is here: http://lexandera.com/2009/01/extracting-html-from-a-webview/)

Of course, once you get the HTML code (string) you can do anything that you want such as replacing the text as you wanted!

Manipulated HTML string can be loaded into the view with following code snippet:

webview.loadData(newHtmlStr, "text/html", "utf-8");

newHtmlStr is the new data and it must be URI-escaped!

Community
  • 1
  • 1
omt66
  • 4,765
  • 1
  • 23
  • 21