Most of the answer is right but please notice that: SupportMultipleWindows must be set as false.
mWebView.getSettings().setSupportMultipleWindows(false);
and now set webViewClint and get loading URL.
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
Log.d(TAG,"URL: "+url);
view.loadUrl(url);
/**
* if you wanna open outside of app
if (url != null && url.startsWith(URL)) {
view.loadUrl(url);
return false;
}
// Otherwise, give the default behavior (open in browser)
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);**/
return true;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
});