Reputation: 921
Background
I am making an app which uses Quora links All Links(profiles,answers,topics,except sign in) are Opening in My App only .
Problem
There is a option "Open in App" , I want to Remove that Option.Clicking on the Cross Button Doesn't work.
User Can't Sign in the Quora , Sign in Link is not opening.
In both cases the app is stuck .I tried WebView Client Solution that is working fine but for sign in case it is not working.
Upvotes: 0
Views: 658
Reputation: 4548
There are two require that you need:
and solution you can found at WebViewClient class:
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(!url.equals(currentUrl)){ //currentUrl is url that signin with navigated.
view.loadUrl(url);
}
return true;
}
@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')[0].style.display='none';})()");
}
});
Upvotes: 1