browserAction.openPopup()
语法
js
browser.browserAction.openPopup(
options // 可选对象
)
参数
details
可选-
一个包含以下属性的对象:
windowId
可选-
integer
。要为其打开弹出窗口的窗口。默认为当前窗口。
返回值
一个 Promise
,兑现时不带任何参数。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
openPopup |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
- User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
示例
当用户选择上下文菜单项时,打开弹出窗口:
js
browser.menus.create({
id: "open-popup",
title: "open popup",
contexts: ["all"],
});
browser.menus.onClicked.addListener(() => {
browser.browserAction.openPopup();
});