Question:
There is a page with a structure
<head></head>
<body>
<div id="container">
<div id="header"></div>
<div id="main"></div>
</div>
</body></html>
How can I hide <div id="header"></div>
and everything inside it in the browser?
public class HelloWebViewClient extends WebViewClient
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
view.loadUrl("javascript:document.getElementsById(header).style.display = 'none'; ");
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lichkab);
//
//
mWebView.getSettings().setJavaScriptEnabled(true);
//
mWebView.loadUrl("https://tetrapolis.handybank.ru/");
//mWebView.getSettings().setLoadsImagesAutomatically(false);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.setWebViewClient(new HelloWebViewClient());
}
Answer:
Use evaluateJavascript function?
Read the documentation? 😀
http://developer.android.com/reference/android/webkit/WebView.html
True, there is a nuance – this is for kit kata only.
For earlier versions, I think, you need to download html, add a script there, and send it to the view.