docs.rodeo

MDN Web Docs mirror

tabs

{{AddonSidebar}} 

Interact with the browser’s tab system.

[!NOTE] When using Manifest V3 or higher, the methods to execute scripts, insert CSS, and remove CSS are provided by the {{WebExtAPIRef("scripting")}}  API through the {{WebExtAPIRef("scripting.executeScript()")}} , {{WebExtAPIRef("scripting.insertCSS()")}}  and {{WebExtAPIRef("scripting.removeCSS()")}}  methods.

You can use this API to get a list of opened tabs, filtered by various criteria, and to open, update, move, reload, and remove tabs. You can’t directly access the content hosted by tabs using this API, but you can insert JavaScript and CSS into tabs using the {{WebExtAPIRef("tabs.executeScript()")}}  or {{WebExtAPIRef("tabs.insertCSS()")}}  APIs.

You can use most of this API without any special permission. However:

Alternatively, you can get these permissions temporarily, only for the currently active tab and only in response to an explicit user action, by asking for the "activeTab" permission.

Many tab operations use a Tab id. Tab ids are guaranteed to be unique to a single tab only within a browser session. If the browser is restarted, then it can and will reuse tab ids. To associate information with a tab across browser restarts, use {{WebExtAPIRef("sessions.setTabValue()")}} .

Types

Properties

Functions

Events

Browser compatibility

{{Compat}} 

{{WebExtExamples("h2")}} 

[!NOTE] This API is based on Chromium’s chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

In this article

View on MDN