-api-id | -api-type |
---|---|
E:Windows.UI.Xaml.Controls.WebView.NavigationStarting |
winrt event |
Occurs before the WebView navigates to new content.
<WebView NavigationStarting="eventhandler" />
You can cancel navigation in a handler for this event by setting the WebViewNavigationStartingEventArgs.Cancel property to true.
WebView navigation events occur in the following order:
- NavigationStarting
- ContentLoading
- DOMContentLoaded
- NavigationCompleted
Similar events occur in the same order for each iframe in the WebView content:
The following code example demonstrates how to handle this event to update a text box used as an address bar. For the complete example, see the XAML WebView control sample.
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;
}
}
WebViewNavigationStartingEventArgs, XAML WebView control sample