I build a WebView which displays a website. The website contains links without a target=\"_blank\" attribute and some with it.
I need to op
I faced same problem. I wanted to open my web sites pages inside the application and rest all the pages should be open in Default Browser. I used one technique. If URL contains my website name, then I opened it in WebView and rest all the websites opened in Default browser.
Find Below code, I hope It would be useful for all who faced such problems.
private class MyBrowser extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("/internetgeeks")) {
browser.loadUrl(url);
return false;
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
}
}
}