WebView.NavigationStarting Evento

Definição

Ocorre antes que o WebView navegue até o novo conteúdo.

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

Tipo de evento

Exemplos

O exemplo de código a seguir demonstra como manipular esse evento para atualizar uma caixa de texto usada como uma barra de endereços. Para obter o exemplo completo, consulte o exemplo de controle 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;
    }
}

Comentários

Você pode cancelar a navegação em um manipulador para esse evento definindo a propriedade WebViewNavigationStartingEventArgs.Cancel como true.

Os eventos de navegação do WebView ocorrem na seguinte ordem:

Eventos semelhantes ocorrem na mesma ordem para cada iframe no conteúdo do WebView :

Aplica-se a

Confira também