Reputation: 189
Subscribe EvenHandler
:
wv.NavigationStarting += webView_NavigationStarting;
EvenHandler
Implementation
private static void webView_NavigationStarting(object sender, WebViewNavigationStartingEventArgs args)
{
var url = args.Uri.AbsoluteUri.Substring(args.Uri.AbsoluteUri.LastIndexOf("/") + 1);
int parameterCount = url.Split('_').Length;
}
When URL is valid it navigates perfectly fine, otherwise EvenHandler
was not called.
And the pop up below shows:
Upvotes: 1
Views: 809
Reputation: 7233
You can use the WebView.UnsupportedUriSchemeIdentified event to handle unknown uri's.
private void webView_OnUnsupportedUriSchemeIdentified(WebView sender, WebViewUnsupportedUriSchemeIdentifiedEventArgs args)
{
args.Handled = true;
// up to you what to do with args.Uri
}
Be aware that if the link is invalid, the WebView.NavigationFailed
will be raised instead!
Upvotes: 2