Home > DeveloperSection > Forums > How to Android WebView Opens links in browser instead of app?
Elena Glibart
Elena Glibart

Total Post:33

Points:233
Posted on    February-03-2015 11:11 PM

 Mobile Development Android  Android sdk 
Ratings:


 1 Reply(s)
 696  View(s)
Rate this:
Every time I click on a link in the webview, it takes me out of the webview and into a separate browser window. How do I get all the links to open in the webview?


Lillian Martin

Total Post:27

Points:189
Posted on    February-03-2015 11:25 PM

You need to implement setWebViewClient(....) like so.

webView.setWebViewClient(new WebViewClient() {

 

@Override

public boolean shouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);

        return true;

        }

});


Don't want to miss updates? Please click the below button!

Follow MindStick