tabs.query()

Gets all tabs that have the specified properties, or all tabs if no properties are specified.

Syntax

browser.tabs.query(
  queryInfo,             // object
  function(result) {...} // function
)

Parameters

queryInfo
object. The query() function will only get tabs whose properties match the properties included here. To learn more about these properties, see the tabs.Tab documentation.
 
activeOptional
boolean. Whether the tabs are active in their windows.
pinnedOptional
boolean. Whether the tabs are pinned.
audibleOptional
boolean. Whether the tabs are audible.
mutedOptional
boolean. Whether the tabs are muted.
highlightedOptional
boolean. Whether the tabs are highlighted.
currentWindowOptional
boolean. Whether the tabs are in the current window.
lastFocusedWindowOptional
boolean. Whether the tabs are in the last focused window.
statusOptional
tabs.TabStatus. Whether the tabs have completed loading.
titleOptional
string. Match page titles against a pattern.
urlOptional
string or array of string. Match tabs against one or more match patterns. Note that fragment identifiers are not matched.
windowIdOptional
integer. The ID of the parent window, or windows.WINDOW_ID_CURRENT for the current window.
windowTypeOptional
tabs.WindowType. The type of window the tabs are in.
indexOptional
integer. The position of the tabs within their windows.
callback
function. The function is passed the following arguments:
result
array of tabs.Tab.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic supportNo

Examples

Example add-ons

Acknowledgements

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,