如何检索的WebView HTML内容(字符串)字符串、内容、WebView、HTML

2023-09-12 22:00:45 作者:梦落轻寻

我如何检索当前在web视图中显示的所有HTML内容?

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

我发现 WebView.loadData(),但我无法找到相反的等价物(如WebView.getData())

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

请注意我感兴趣的检索数据超过了我无法控制Web页面(即我不能注入Javascript函数到这些网页,这样它会调用的WebView的JavaScript接口)。

Please note that I am interested in retrieving that data for web pages that I have no control over (i.e. I cannot inject a Javascript function into those pages, so that that it would call a Javascript interface in WebView).

推荐答案

不幸的是,没有简单的方法来做到这一点。

Unfortunately there is not easy way to do this.

请参阅How我从一个Web视图获取网页内容?

您可以只让一个Htt的prequest到同一页作为您的WebView,并获得响应。

You could just make a HttpRequest to the same page as your WebView and get the response.