Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force webview to open urls inside application - android app

Tags:

android

How to force WebView to open all the urls inside the application?

like image 288
user565310 Avatar asked Jan 11 '11 10:01

user565310


1 Answers

You need to override the WebViewClient for your WebView.

See here for the details: it's pretty straight forward.

Notice Step 6 in particular.

To open links clicked by the user, simply provide a WebViewClient for your WebView, using setWebViewClient(). For example:

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebViewClient(new WebViewClient());

That's it. Now all links the user clicks load in your WebView.

like image 153
C0deAttack Avatar answered Sep 28 '22 02:09

C0deAttack