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.

Event data

The params field in the event notification is an 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. If the navigation was started using the browsingContext.navigate or browsingContext.reload command, this ID matches the navigation value in the command's response. The same ID is shared by all events related to this navigation, including other navigation events in the browsingContext module and events in the network module.

timestamp

A non-negative integer that represents the time 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.

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.

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 (you don't receive that notification because 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:

json
{
  "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

Browser compatibility

See also