There\'s a webpage I pull up with webview, however i\'d like to hide the 1 text link at the top. Is there a way to do this? The link is in the body, so I can\'t hide the bod
final WebView webview = (WebView)findViewById(R.id.browser);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
// hide element by class name
webview.loadUrl("javascript:(function() { " +
"document.getElementsByClassName('your_class_name')[0].style.display='none'; })()");
// hide element by id
webview.loadUrl("javascript:(function() { " +
"document.getElementById('your_id').style.display='none';})()");
}
});
webview.loadUrl(url);