50
rated 0 times
[
51]
[
1]
/ answers: 1 / hits: 15939
/ 7 Years ago, sat, december 16, 2017, 12:00:00
I want to remove the header of the website in android 'WebView
'. With the Code that I have, it works. But the problem is that the 'WebView
' is removing the header after the page loaded completely. I want to remove it, while it is loading.
Thats the code snippet:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
webView.loadUrl(javascript:(function() { +
var head = document.getElementsByTagName('header')[0];
+ head.parentNode.removeChild(head); +
})());
webView.loadUrl(javascript:(function() { +
var head = document.getElementsByTagName('footer')[0];
+ head.parentNode.removeChild(head); +
})());
}
});
More From » android