我有一个webview,其中一些HTML内容显示有一些javascript和jquery和CSS . 在这个html内容中,我有一些 anchor tag (...) with target="_blank" 属性 . 当我点击这些链接时,它在同一个webview页面中打开,但我没有这样做,而是想把它打开到外部浏览器中 . 这在xamarin形式中是如何实现的 .
在您的网页浏览中 grab Navigating Event 并致电 Device.Open(your uri)
Navigating Event
Device.Open(your uri)
webview.Navigating += (s, e) => { if (e.Url.StartsWith("http")) { try { var uri = new Uri(e.Url); Device.OpenUri(uri); } catch (Exception) { } e.Cancel = true; } };
1 回答
在您的网页浏览中 grab
Navigating Event
并致电Device.Open(your uri)