简体   繁体   English

在WebView上打开链接

[英]Open a link on WebView

I am using WebView on my application. 我在应用程序上使用WebView。 the WebView contains a web site with link. WebView包含一个带有链接的网站。 When I am clicking on the link, it is open the link on the application(By webView). 当我单击链接时,它将在应用程序上打开链接(通过webView)。 How can I open the link with the browser? 如何使用浏览器打开链接? Thank you! 谢谢!

Try something like this 试试这个

new Intent(Intent.ACTION_VIEW, Uri.parse(url)));

or if you need to override Webview link click use this 或者如果您需要覆盖Webview链接,请使用此

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;

This should do the trick 这应该可以解决问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM