大网数据广告活动
Web 标准与前端开发

`browsingContext.navigationCommitted` event

· 52CE 我爱测

The `browsingContext.navigationCommitted` event of the `browsingContext` module fires when the browser commits a cross-document navigation and begins loading the new page.

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.
  • navigation
    • : 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:

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

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。