partiz partiz - 2 months ago 12
Android Question

Access Meta Data from android WebView

How to access Meta Data of a HTML page loaded into a WebView in Android?

I search for hours stackoverflow.com and google and I coudn't find any answer.

I only could get url and title by this code:

webView.getTitle();
webView.getUrl();


Dose is it imposible and webview not support it?

Answer

Don't open the URL in the WebView.

First. open an HttpURLConnection to the URL. Read the output from the server and you can scan through the server response to find your meta data.

As you are reading the server output, write the data into a buffer, then use loadData instead of loadUrl to display the buffered data in the WebView