How do I get the web page contents from a WebView?

后端 未结 7 1841
北恋
北恋 2020-11-22 06:19

On Android, I have a WebView that is displaying a page.

How do I get the page source without requesting the page again?

It seems WebView

相关标签:
7条回答
  • 2020-11-22 07:24

    You also need to annotate the method with @JavascriptInterface if your targetSdkVersion is >= 17 - because there is new security requirements in SDK 17, i.e. all javascript methods must be annotated with @JavascriptInterface. Otherwise you will see error like: Uncaught TypeError: Object [object Object] has no method 'processHTML' at null:1

    0 讨论(0)
提交回复
热议问题