Android Webview: Display Only The Content Of The Website
I want to hide header and footer of the website but its not working Please Help I wanted to know if it was possible to display only certain parts of a website in a WebView. MainAct
Solution 1:
I have tried this Javascript Code but its showing website then after its removing
public classmyWebClientextendsWebViewClient
{
@Override
public voidonPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
view.loadUrl("javascript:(function() { " +
"var element = document.getElementById('mainHeader');"
+ "element.parentNode.removeChild(element);" +
"var element = document.getElementById('footerRights');"+ "element.parentNode.removeChild(element);" + "})()");
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
returntrue;
}
@Override
public voidonPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
}
Post a Comment for "Android Webview: Display Only The Content Of The Website"