Open Mikilll94 opened 4 years ago
Original repro doesn't build, so here's another: _8386 Repro.zip
I will add also that if you change code in @hartez repro project in MainPage.xaml.cs
to this:
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html><body><p>This is a WebView!</p>
<div>
<a href=""mailto:cfinley@fake.com"">Send an email</a>
</div>
<div>
<a href=""tel:123456789"">Call me</a>
</div>
</body></html>";
TheWebView.Source = htmlSource;
}
}
you will see that tel: links on Android also do not work.
Is there any workarournd for this? the best I got so far is to reload the content of the WebView. In that way the error page will show and quickly be replaced by the original page
You can use the Navigating
event. WebNavigatingEventArgs.Url
will have the target, then you can do something like this:
if (e.Url.StartsWith("http"))
{
Browser.OpenAsync(e.Url);
e.Cancel = true;
}
Description
On Android, WebView does not open links with mailto: or tel: href attribute
Steps to Reproduce
Expected Behavior
When tapping an email link - mailbox should open When tapping a phone link - phone dialer should
Actual Behavior
Page with info "Webpage not available" opens.
Basic Information
Problem exists only on Android. On iOS and UWP everything works fine.
Screenshots
Reproduction Link
App1.zip