[FIXED] Xamarin: Problem with call on WebView <tel:…link

Issue

Good evening,

I’ve been trying to solve the problem with clicking on <tel:….link in webview for a few days now.

I have tried several manuals but none of them work.
Can you please advise me?

Thank you

Solution

Use the Webview.OnNavigating event. Something like this should work:

Page.xaml.cs

private void WebView_OnNavigating(object sender, WebNavigatingEventArgs navigationEvent) {
    if (navigationEvent.Url.StartsWith("tel:")) {
         navigationEvent.Cancel = true;
         Xamarin.Essentials.Launcher.OpenAsync(navigationEvent.Url);
    }
}

Page.xaml

<WebView Navigating="WebView_OnNavigating" />

Answered By – Simon Corcos

Answer Checked By – Mary Flores (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published