browsingContext.navigationCommitted event
The browsingContext.navigationCommitted event of the browsingContext module fires when the browser commits a cross-document navigation and begins loading the new page.
Description
A navigation is committed when the browser has accepted the URL from the server response and begun loading the new page, but before any content has been parsed or rendered. Page content is not yet available at this point.
In the lifecycle of a successful navigation, this event fires after browsingContext.navigationStarted and before browsingContext.domContentLoaded and browsingContext.load events.
If you set wait to "none" for the browsingContext.navigate and browsingContext.reload commands, they return as soon as browsingContext.navigationCommitted fires.
This event does not fire for same-document navigations.
For navigations to a URL fragment, see browsingContext.fragmentNavigated.
For URL changes made through the History API without a full navigation, see browsingContext.historyUpdated.
Event data
The params field in the event notification is a navigation object with the following fields:
context-
A string that contains the ID of the context in which the navigation is committed.
-
A string that contains the UUID that uniquely identifies this navigation. This ID matches the
navigationvalue in the response of thebrowsingContext.navigateandbrowsingContext.reloadcommands. timestamp-
A non-negative integer that represents the time in UTC when the event was fired, as milliseconds elapsed since the epoch.
url-
A string that contains the URL being loaded, including any basic auth credentials.
userContextOptional-
A string that contains the ID of the user context in which the navigation is committed.
Examples
>Receiving an event when a cross-document navigation commits
Assume you have a WebDriver BiDi connection and an active session with a subscription to browsingContext.navigationCommitted.
Suppose you use browsingContext.navigate to load https://example.com, passing the context ID you obtain from browsingContext.getTree.
The browser first fires a browsingContext.navigationStarted event (that notification is not received since the subscription in this example is only to browsingContext.navigationCommitted).
Once the browser accepts the server response and commits to loading the page, it sends the following notification, where the context value matches the context ID you passed to browsingContext.navigate:
{
"type": "event",
"method": "browsingContext.navigationCommitted",
"params": {
"context": "9f271a75-04b2-4b35-80cc-e22427d446fc",
"navigation": "dc716296-7076-4ec0-b446-51c6fb5fefe8",
"timestamp": 1781715436774,
"url": "https://example.com"
}
}
Specifications
| Specification |
|---|
| WebDriver BiDi> # event-browsingContext-navigationCommitted> |