I have a Webview in my app and I want to intercept any taps and open the links in IE rather than inside the Webview in the app.
I can only see NavigationFailed and LoadingComplete events, nothing regarding an "about to navigate" event which I could intercept.
It seems there isn't any way to catch any navigation events. However, you can intercept script events called in JavaScript with window.external.notify()
Assuming the page is something you're hosting yourself, you can replace
<a href="http://www.lightwoodgames.com">LINK</a>
With
<a href="javascript:window.external.notify('http://www.lightwoodgames.com')">LINK</a>
Then in your project you'll want to add
webview.ScriptNotify += webview_ScriptNotify;
webview.AllowedScriptNotifyUris = WebView.AnyScriptNotifyUri;
protected async void webview_ScriptNotify(object sender, NotifyEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(e.Value));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With