I am working on an Android project, and my task is to open a url in an embedded webview. Here is the code. When a 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 the google.com it is perfectly opened in embedded webview:
But when I replace the link with "http://videoshare.loveworldapis.com/commentredirect.php" url, the link is opened in full screen instead of embedded portion of webview as shown below:
Can you tell me what modification should I do to open the second website into embedded webview instead of full screen.
The WebView, by default, will open successive URLs by firing an intent, and opening the browser. To disable it so all URLs load in the WebView do this:
webView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
return false;
}
});
I suspect your web site load involves an HTTP redirect, and that redirect is causing the browser to open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With