java – How to get html page code from webview android?


Good afternoon. It is necessary to pull out a link to one image from the Android WebView. How can I access html from java code?


According to en-SO , with API 19 it's possible like this:

    "(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();",
     new ValueCallback<String>() {
        public void onReceiveValue(String html) {
            Log.d("HTML", html); 
            // code here
Scroll to Top