1

I have a problem, when I have a webview in my app and I click on a link in this app, it opens the chrome app every time :(

Code:

   WebView wv = (WebView) findViewById(R.id.urlWebView);
        wv.loadUrl("http://www.google.de/?gfe_rd=cr&ei=WcE5U5CoN-il8wfE1YG4Dg");

When I click on the search button it opens a new tab :((( Thanks for help!

dm78
  • 1,570
  • 1
  • 16
  • 28

2 Answers2

1

You need to set the WebViewClient

See this link for the exact same issue: Link should be open in same web view in Android

Community
  • 1
  • 1
Randy
  • 4,351
  • 2
  • 25
  • 46
0

This is behaviour of links in webview as android guide in here at "Handling Page Navigation" section defines;

When the user clicks a link from a web page in your WebView, the default behavior is for Android to launch an application that handles URLs.

But it must be ok on simple url loading like "www.google.com", however in your case, url causes a redirection like external links do. That's why you should follow the page navigation methods.

Cem Özer
  • 1,263
  • 11
  • 19