pageAction.hide()
隐藏指定标签页的页面操作。
hide()
会覆盖模式匹配,因此即便标签页的 URL 与 show_matches
匹配,也不会在指定的标签页中显示页面操作。
语法
js
browser.pageAction.hide(
tabId // 整型
)
参数
tabId
-
integer
。你希望隐藏的页面操作所在的标签页的 ID。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
hide |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
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.pageAction.onClicked.addListener((tab) => {
browser.pageAction.hide(tab.id);
});
示例扩展
备注:
该 API 基于 Chromium 的 chrome.pageAction
API。本文衍生自 Chromium 代码中的 page_action.json
。