[英]How to hide element of a webpage from webview in android
I have no idea about javascript :). 我不了解javascript :)。 I am trying to load a page in my webview in android, and when that page loads, a particular image in the webpage must be hidden.
我正在尝试在android的Web视图中加载页面,并且在加载该页面时,必须隐藏该页面中的特定图像。 This is my following code
这是我的以下代码
private class MWebviewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
//url.
// String javascript="javascript: document.getElementById('msg').innerHTML='Hello "+user+"!';";
String javascriptM="javascript: document.getElementById('logo').style.visibility = 'hidden'; ";
view.loadUrl(javascriptM);
Log.d("++++++++","+++++++");
}
}
So the thing is It is loading the page again with 所以事情是它正在再次加载页面
hidden
隐
written and nothing else on webpage. 网页上没有其他内容。 What do I need to do so that I can only hide that particular image with id "logo" and load rest of the page ?
我需要怎么做才能只隐藏ID为“ logo”的特定图像并加载页面的其余部分? Thanks much :)
非常感谢 :)
change visiblity to display and hidden to none to hide it in your view 更改可见性以显示和隐藏,以将其隐藏在您的视图中
eg : document.getElementById('logo').style.display = 'none'; 例如:document.getElementById('logo')。style.display ='none';
Hope this will solve your problem 希望这能解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.