How to retrieve HTML content from WebView (as a string)

前端 未结 6 2144
旧巷少年郎
旧巷少年郎 2020-11-30 00:55

How do I retrieve all HTML content currently displayed in a WebView?

I found WebView.loadData() but I couldn\'t find the opposite equivalent (e.g. WebVi

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 01:20

    webView.evaluateJavascript("(function(){return window.document.body.outerHTML})();", 
          new ValueCallback() {
              @Override
              public void onReceiveValue(String html) {
    
              }
          });
    

提交回复
热议问题