Which is the simplest method to get html code from a webview? I have tried several methods from stackoverflow and google, but can\'t find an exact method. Please mention an
In KitKat and above, you could use evaluateJavascript
method on webview
wvbrowser.evaluateJavascript(
"(function() { return (''+document.getElementsByTagName('html')[0].innerHTML+''); })();",
new ValueCallback() {
@Override
public void onReceiveValue(String html) {
Log.d("HTML", html);
// code here
}
});
See this answer for more examples