Home > Blockchain >  Xamarin: Problem with call on WebView <tel:...link
Xamarin: Problem with call on WebView <tel:...link

Time:09-21

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

CodePudding user response:

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" />
  • Related