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

`browsingContext.activate` command

· 52CE 我爱测

The `browsingContext.activate` command of the `browsingContext` module brings a top-level context to the foreground and gives it focus.

The browsingContext.activate command of the browsingContext module brings a top-level context to the foreground and gives it focus.

Syntax

{
  "method": "browsingContext.activate",
  "params": {
    "context": "93ee5bd6-d256-4608-a002-9a8995cc0e5f"
  }
}

Parameters

The params field contains:

Return value

The result field in the response is an empty object ({}).

Errors

  • invalid argument
    • : A required parameter is missing or has an invalid type. This error is also returned when the context specified by context is not a top-level context.
  • no such frame
    • : No context with the given context ID is found.
  • unsupported operation
    • : The browser cannot bring the context to the foreground.

Examples

Activating a background tab

The following example shows how to activate a background tab.

With a WebDriver BiDi connection and an active session, suppose you create a tab in the background using browsingContext.create with background: true, which returns the context ID of the tab. Send the following message to activate it:

{
  "id": 1,
  "method": "browsingContext.activate",
  "params": {
    "context": "5e5e96e8-5247-4f22-9b35-a4a2d841cbaa"
  }
}

The browser brings the tab to the foreground and responds as follows:

{
  "id": 1,
  "type": "success",
  "result": {}
}

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

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

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