Url opens in full screen instead of Webview

I am working on an Android project and my task is to open the URL in the embedded webview. Here is the code. When the button is clicked, I open the URL as follows:

yookosBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { linearLayout.setVisibility(View.GONE); webview.setVisibility(View.VISIBLE); webview.loadUrl("https://www.google.com.pk/"); } }); 

1: When I open google.com, it opens perfectly in the built-in web view:

enter image description here

But when I replace the link with the link http://videoshare.loveworldapis.com/commentredirect.php , the link opens in full screen instead of the built-in part of the webview as shown below:

enter image description here

Can you tell me what kind of modification I have to do in order to open the second website in the integrated web browser instead of full screen.

+4
source share
1 answer

WebView will open sequential URLs by default, firing the intent and opening the browser. To disable it so that all URLs load in the WebView, follow these steps:

 webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false; } }); 

I suspect that loading your site is related to HTTP redirection, and redirecting causes the browser to open.

+10
source

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


All Articles