browserAction.disable()
タブに対してブラウザーアクションを無効にします。つまり、タブがアクティブな時クリックされなくなります。
書式
js
browser.browserAction.disable(
tabId, // optional integer
);
パラメーター
tabId
省略可-
integer
. ブラウザーアクションを無効にしたいタブの ID です。
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
disable |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.tabs.onCreated.addListener(() => {
browser.browserAction.enable();
});
browser.browserAction.onClicked.addListener(() => {
browser.browserAction.disable();
});
アクティブなタブにだけブラウザーアクションを無効にします:
js
browser.browserAction.onClicked.addListener((tab) => {
browser.browserAction.disable(tab.id);
});
メモ:
This API is based on Chromium's chrome.browserAction
API. This documentation is derived from browser_action.json
in the Chromium code.Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.