Exemple #1
0
        private void WebView_OnNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs e)
        {
            if (e.Uri != null && e.Uri.AbsoluteUri == "about:blank")
            {
                e.Cancel = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(e.Uri?.OriginalString))
            {
                return;
            }

            e.Cancel = true;
            ProcessHelpers.OpenUrlInExternalBrowser(e.Uri?.OriginalString);
        }
Exemple #2
0
        private void WebView_OnNavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e)
        {
            if (!e.IsUserInitiated)
            {
                return;
            }

            if (e.Uri != null && e.Uri.Contains("about:blank"))
            {
                e.Cancel = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(e.Uri))
            {
                return;
            }

            e.Cancel = true;
            ProcessHelpers.OpenUrlInExternalBrowser(e.Uri);
        }
 private void OpenHyperlink(object sender, ExecutedRoutedEventArgs e)
 {
     ProcessHelpers.OpenUrlInExternalBrowser(e.Parameter.ToString());
 }