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

`browsingContext` module

· 52CE 我爱测

The **`browsingContext`** module contains commands and events for managing contexts.

The browsingContext module contains commands and events for managing contexts.

Contexts

A context is a navigable that can load a document, such as a tab, an iframe, or a popup. Each context has a unique string identifier called a context ID that is used to reference it across commands and events.

There are two types of contexts:

  • Top-level context
    • : This type of context has no parent, corresponding to a browser tab or a standalone window. Top-level contexts belong to a user context and live inside a client window.
  • Child context
    • : This type of context is nested inside a top-level context, such as an iframe. Child contexts are returned as children of their parent by browsingContext.getTree.

For example, if you open a browser window and navigate to https://example.com, that creates one top-level context with its own context ID. If that page contains an <iframe> loading https://other.com, that creates a child context nested under the top-level context. Opening a new tab creates a second top-level context with its own context ID. Calling browsingContext.getTree would return both top-level contexts, with the first one having a child context.

Commands

Events

Specifications

Browser compatibility

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

资料来源与适用范围

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

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

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