Force webview to open URLs within an app - Android app

How to get WebView to open all urls inside an application?

+8
android
source share
1 answer

You need to override WebViewClient for your WebView .

See here for more details : this is pretty straight forward.

Pay attention to step 6 in particular.

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

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

What is it. Now all the links that the user clicks are loaded into your WebView .

+12
source share

Source: https://habr.com/ru/post/650921/


All Articles