Reputation: 629
I have one webview where some html content are display with some javascript and jquery and CSS. In this html content I have some anchor tag (...) with target="_blank" attribute. when I click on these links its open in same webview page but instead of doing this I want to open it into external browser. How is this possible in xamarin forms.
Upvotes: 0
Views: 820
Reputation: 6203
Catch Navigating Event
on your webview and call 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;
}
};
Upvotes: 3