Partager via


WebView.NavigationStarting Événement

Définition

Se produit avant que webView accède au nouveau contenu.

// Register
event_token NavigationStarting(TypedEventHandler<WebView, WebViewNavigationStartingEventArgs const&> const& handler) const;

// Revoke with event_token
void NavigationStarting(event_token const* cookie) const;

// Revoke with event_revoker
WebView::NavigationStarting_revoker NavigationStarting(auto_revoke_t, TypedEventHandler<WebView, WebViewNavigationStartingEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView,WebViewNavigationStartingEventArgs> NavigationStarting;
function onNavigationStarting(eventArgs) { /* Your code */ }
webView.addEventListener("navigationstarting", onNavigationStarting);
webView.removeEventListener("navigationstarting", onNavigationStarting);
- or -
webView.onnavigationstarting = onNavigationStarting;
Public Custom Event NavigationStarting As TypedEventHandler(Of WebView, WebViewNavigationStartingEventArgs) 
<WebView NavigationStarting="eventhandler" />

Type d'événement

Exemples

L’exemple de code suivant montre comment gérer cet événement pour mettre à jour une zone de texte utilisée comme barre d’adresse. Pour obtenir l’exemple complet, consultez l’exemple de contrôle XAML WebView.

void webViewA_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
{
    string url = "";
    try { url = args.Uri.ToString(); }
    finally
    {
        address.Text = url;
        appendLog(String.Format("Starting navigation to: \"{0}\".\n", url));
        pageIsLoading = true;
    }
}

Remarques

Vous pouvez annuler la navigation dans un gestionnaire pour cet événement en définissant la propriété WebViewNavigationStartingEventArgs.Cancel sur true.

Les événements de navigation WebView se produisent dans l’ordre suivant :

Des événements similaires se produisent dans le même ordre pour chaque iframe du contenu WebView :

S’applique à

Voir aussi