OnNavigationStarting - cWebView2Browser
Sent when a new navigation operation is being initiated
Type: Event
Parameters
| Parameter | Type | Description |
|---|---|---|
| iNavigationId | UBigInt | Navigation operation identifier |
| sUrl | String | New URL that will be loaded |
| bIsRedirected | Boolean | True if this navigation is caused by a server redirect |
| bIsUserInitiated | Boolean | True if the navigation is caused by a user action |
| ByRef bCancelnavigation | Boolean | Set to true to cancel the navigation |
Syntax
Procedure OnNavigationStarting UBigInt iNavigationId String sUrl Boolean bIsRedirected Boolean bIsUserInitiated ByRef Boolean bCancelnavigation
Description
This message is sent when a new navigation operation is being initiated.
It provides details on the new navigation operation like the loaded URL and how the operation was triggered.
The bCancelNavigation parameter can be set to True to stop the navigation operation from proceeding.
Each navigation operation gets a unique identifier indicated by the iNavigationId parameter. The OnNavigationCompleted event also gets this same identifier.
Some navigation operations fire multiple OnNavigationStarting events whilst there is always only one OnNavigationCompleted. HTTP redirects returned by the server can cause this to happen.
The list below shows in which order navigation related events happen with some details.
-
OnNavigationStarting WebView2 starts to navigate to the specified URL. The host application can disallow the the navigation by setting bCancelNavigation to true. On cancelling or failure it will skip directly to OnNavigationCompleted.
-
OnSourceChanged The source changed to a new URL. This does not indicate that a network request happened.
-
OnContentLoading WebView starts loading content for the new page.
-
OnHistoryChanged The navigation caused the history to be updated.
-
OnNavigationCompleted The navigation has completed and the new content has been loaded.