I want to load into the WebView only one div
with id results
of all the website.
I have tried adding a JavaScriptInterface like this:
webView.setJavaScriptEnabled(true);
webView.addJavascriptInterface(this, "android");
@JavascriptInterface
public void onData(String value) {
webView.loadData(value, "text/html", null);
}
And inside my WebViewClient:
@Override
public void onPageFinished(WebView view, String url) {
webView.loadUrl("javascript:android.onData(document.getElementById('results'));");
}
But it simply doesn't works, the whole webpage is loaded instead of the div
I want.