Description
Use the chrome.tabs API to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser.
Overview
The Tabs API not only offers features for manipulating and managing tabs, but can also detect the language of the tab, take a screenshot, and communicate with a tab's content scripts.
Permissions
Most features do not require any permissions to use. For example: creating a new tab, reloading a tab, navigating to another URL, etc.
There are three permissions developers should be aware of when working with the Tabs API.
- The "tabs" permission
- This permission does not give access to the chrome.tabsnamespace. Instead, it grants an extension the ability to calltabs.query()against four sensitive properties ontabs.Tabinstances:url,pendingUrl,title, andfavIconUrl.
- Host permissions
- Host permissions allow an extension to read and query a matching tab's four sensitive
tabs.Tabproperties. They can also interact directly with the matching tabs using methods such astabs.captureVisibleTab(),tabs.executeScript(),tabs.insertCSS(), andtabs.removeCSS().
- The "activeTab" permission
- activeTabgrants an extension temporary host permission for the current tab in response to a user invocation. Unlike host permissions,- activeTabdoes not trigger any warnings.
Manifest
The following are examples of how to declare each permission in the manifest:
  {
    "name": "My extension",
    ...
    "permissions": [
      "tabs"
    ],
    ...
  }
  
  {
    "name": "My extension",
    ...
    "host_permissions": [
      "http://*/*",
      "https://*/*"
    ],
    ...
  }
  
  {
    "name": "My extension",
    ...
    "permissions": [
      "activeTab"
    ],
    ...
  }
Use cases
The following sections demonstrate some common use cases.
Opening an extension page in a new tab
A common pattern for extensions is to open an onboarding page in a new tab when the extension is installed. The following example shows how to do this.
background.js:
chrome.runtime.onInstalled.addListener(({reason}) => {
  if (reason === 'install') {
    chrome.tabs.create({
      url: "onboarding.html"
    });
  }
});
Get the current tab
This example demonstrates how an extension's service worker can retrieve the active tab from the currently-focused window (or most recently-focused window, if no Chrome windows are focused). This can usually be thought of as the user's current tab.
  async function getCurrentTab() {
    let queryOptions = { active: true, lastFocusedWindow: true };
    // `tab` will either be a `tabs.Tab` instance or `undefined`.
    let [tab] = await chrome.tabs.query(queryOptions);
    return tab;
  }
  
  function getCurrentTab(callback) {
    let queryOptions = { active: true, lastFocusedWindow: true };
    chrome.tabs.query(queryOptions, ([tab]) => {
      if (chrome.runtime.lastError)
      console.error(chrome.runtime.lastError);
      // `tab` will either be a `tabs.Tab` instance or `undefined`.
      callback(tab);
    });
  }
Mute the specified tab
This example shows how an extension can toggle the muted state for a given tab.
  async function toggleMuteState(tabId) {
    const tab = await chrome.tabs.get(tabId);
    const muted = !tab.mutedInfo.muted;
    await chrome.tabs.update(tabId, {muted});
    console.log(`Tab ${tab.id} is ${muted ? "muted" : "unmuted"}`);
  }
  
  function toggleMuteState(tabId) {
    chrome.tabs.get(tabId, async (tab) => {
      let muted = !tab.mutedInfo.muted;
      await chrome.tabs.update(tabId, { muted });
      console.log(`Tab ${tab.id} is ${ muted ? "muted" : "unmuted" }`);
    });
  }
Move the current tab to the first position when clicked
This example shows how to move a tab while a drag may or may not be in progress. While this example
uses chrome.tabs.move, you can use the same waiting pattern for other calls that modify tabs while
a drag is in progress.
  chrome.tabs.onActivated.addListener(moveToFirstPosition);
  async function moveToFirstPosition(activeInfo) {
    try {
      await chrome.tabs.move(activeInfo.tabId, {index: 0});
      console.log("Success.");
    } catch (error) {
      if (error == "Error: Tabs cannot be edited right now (user may be dragging a tab).") {
        setTimeout(() => moveToFirstPosition(activeInfo), 50);
      } else {
        console.error(error);
      }
    }
  }
  
  chrome.tabs.onActivated.addListener(moveToFirstPositionMV2);
  function moveToFirstPositionMV2(activeInfo) {
    chrome.tabs.move(activeInfo.tabId, { index: 0 }, () => {
      if (chrome.runtime.lastError) {
        const error = chrome.runtime.lastError;
        if (error == "Error: Tabs cannot be edited right now (user may be dragging a tab).") {
          setTimeout(() => moveToFirstPositionMV2(activeInfo), 50);
        } else {
          console.error(error);
        }
      } else {
        console.log("Success.");
      }
    });
  }
Pass a message to a selected tab's content script
This example demonstrates how an extension's service worker can communicate with content scripts in specific browser tabs using tabs.sendMessage().
function sendMessageToActiveTab(message) {
  const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true });
  const response = await chrome.tabs.sendMessage(tab.id, message);
  // TODO: Do something with the response.
}
Extension examples
For more Tabs API extensions demos, explore any of the following:
Types
MutedInfo
The tab's muted state and the reason for the last state change.
Properties
- 
    extensionIdstring optional The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed. 
- 
    mutedboolean Whether the tab is muted (prevented from playing sound). The tab may be muted even if it has not played or is not currently playing sound. Equivalent to whether the 'muted' audio indicator is showing. 
- 
    reasonMutedInfoReason optional The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed. 
MutedInfoReason
An event that caused a muted state change.
Enum
"user"  "capture"  "extension" 
 A user input action set the muted state.
 Tab capture was started, forcing a muted state change.
 An extension, identified by the extensionId field, set the muted state.
Tab
Properties
- 
    activeboolean Whether the tab is active in its window. Does not necessarily mean the window is focused. 
- 
    audibleboolean optional Chrome 45+Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the 'speaker audio' indicator is showing. 
- 
    autoDiscardableboolean Chrome 54+Whether the tab can be discarded automatically by the browser when resources are low. 
- 
    discardedboolean Chrome 54+Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content is reloaded the next time it is activated. 
- 
    favIconUrlstring optional The URL of the tab's favicon. This property is only present if the extension has the "tabs"permission or has host permissions for the page. It may also be an empty string if the tab is loading.
- 
    frozenboolean Chrome 132+Whether the tab is frozen. A frozen tab cannot execute tasks, including event handlers or timers. It is visible in the tab strip and its content is loaded in memory. It is unfrozen on activation. 
- 
    groupIdnumber Chrome 88+The ID of the group that the tab belongs to. 
- 
    heightnumber optional The height of the tab in pixels. 
- 
    highlightedboolean Whether the tab is highlighted. 
- 
    idnumber optional The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a tab may not be assigned an ID; for example, when querying foreign tabs using the sessionsAPI, in which case a session ID may be present. Tab ID can also be set tochrome.tabs.TAB_ID_NONEfor apps and devtools windows.
- 
    incognitoboolean Whether the tab is in an incognito window. 
- 
    indexnumber The zero-based index of the tab within its window. 
- 
    lastAccessednumber Chrome 121+The last time the tab became active in its window as the number of milliseconds since epoch. 
- 
    mutedInfoMutedInfo optional Chrome 46+The tab's muted state and the reason for the last state change. 
- 
    openerTabIdnumber optional The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists. 
- 
    pendingUrlstring optional Chrome 79+The URL the tab is navigating to, before it has committed. This property is only present if the extension has the "tabs"permission or has host permissions for the page and there is a pending navigation.
- 
    pinnedboolean Whether the tab is pinned. 
- 
    selectedboolean DeprecatedPlease use tabs.Tab.highlighted.Whether the tab is selected. 
- 
    sessionIdstring optional The session ID used to uniquely identify a tab obtained from the sessionsAPI.
- 
    statusTabStatus optional The tab's loading status. 
- 
    titlestring optional The title of the tab. This property is only present if the extension has the "tabs"permission or has host permissions for the page.
- 
    urlstring optional The last committed URL of the main frame of the tab. This property is only present if the extension has the "tabs"permission or has host permissions for the page. May be an empty string if the tab has not yet committed. See alsoTab.pendingUrl.
- 
    widthnumber optional The width of the tab in pixels. 
- 
    windowIdnumber The ID of the window that contains the tab. 
TabStatus
The tab's loading status.
Enum
"unloaded"  "loading"  "complete" 
 
 
 
WindowType
The type of window.
Enum
"normal"  "popup"  "panel"  "app"  "devtools" 
 
 
 
 
 
ZoomSettings
Defines how zoom changes in a tab are handled and at what scope.
Properties
- 
    defaultZoomFactornumber optional Chrome 43+Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings. 
- 
    modeZoomSettingsMode optional Defines how zoom changes are handled, i.e., which entity is responsible for the actual scaling of the page; defaults to automatic.
- 
    scopeZoomSettingsScope optional Defines whether zoom changes persist for the page's origin, or only take effect in this tab; defaults to per-originwhen inautomaticmode, andper-tabotherwise.
ZoomSettingsMode
Defines how zoom changes are handled, i.e., which entity is responsible for the actual scaling of the page; defaults to automatic.
Enum
"automatic"  "manual"  "disabled" 
 Zoom changes are handled automatically by the browser.
 Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the extension's responsibility to listen for this event and manually scale the page. This mode does not support per-origin zooming, and thus ignores the scope zoom setting and assumes per-tab.
 Disables all zooming in the tab. The tab reverts to the default zoom level, and all attempted zoom changes are ignored.
ZoomSettingsScope
Defines whether zoom changes persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise.
Enum
"per-origin"  "per-tab" 
 Zoom changes persist in the zoomed page's origin, i.e., all other tabs navigated to that same origin are zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they are all zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode.
 Zoom changes only take effect in this tab, and zoom changes in other tabs do not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab always loads pages with their per-origin zoom factors.
Properties
MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND
The maximum number of times that captureVisibleTab can be called per second. captureVisibleTab is expensive and should not be called too often.
Value
2 
 
TAB_ID_NONE
An ID that represents the absence of a browser tab.
Value
-1 
 
TAB_INDEX_NONE
An index that represents the absence of a tab index in a tab_strip.
Value
-1 
 
Methods
captureVisibleTab()
chrome.tabs.captureVisibleTab(
windowId?: number,
options?: ImageDetails,
callback?: function,
): Promise<string>
Captures the visible area of the currently active tab in the specified window. In order to call this method, the extension must have either the <all_urls> permission or the activeTab permission. In addition to sites that extensions can normally access, this method allows extensions to capture sensitive sites that are otherwise restricted, including chrome:-scheme pages, other extensions' pages, and data: URLs. These sensitive sites can only be captured with the activeTab permission. File URLs may be captured only if the extension has been granted file access.
Parameters
- 
    windowIdnumber optional The target window. Defaults to the current window. 
- 
    optionsImageDetails optional 
- 
    callbackfunction optional The callbackparameter looks like:(dataUrl: string) => void - 
    dataUrlstring A data URL that encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML imgelement for display.
 
- 
    
Returns
- 
            Promise<string> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
connect()
chrome.tabs.connect(
tabId: number,
connectInfo?: object,
): runtime.Port
Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. For more details, see Content Script Messaging.
Parameters
- 
    tabIdnumber 
- 
    connectInfoobject optional - 
    documentIdstring optional Chrome 106+Open a port to a specific document identified by documentIdinstead of all frames in the tab.
- 
    frameIdnumber optional Open a port to a specific frame identified by frameIdinstead of all frames in the tab.
- 
    namestring optional Is passed into onConnect for content scripts that are listening for the connection event. 
 
- 
    
Returns
- 
            A port that can be used to communicate with the content scripts running in the specified tab. The port's runtime.Portevent is fired if the tab closes or does not exist.
create()
chrome.tabs.create(
createProperties: object,
callback?: function,
): Promise<Tab>
Creates a new tab.
Parameters
- 
    createPropertiesobject - 
    activeboolean optional Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults totrue.
- 
    indexnumber optional The position the tab should take in the window. The provided value is clamped to between zero and the number of tabs in the window. 
- 
    openerTabIdnumber optional The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab. 
- 
    pinnedboolean optional Whether the tab should be pinned. Defaults to false
- 
    selectedboolean optional DeprecatedPlease use active. Whether the tab should become the selected tab in the window. Defaults to true
- 
    urlstring optional The URL to initially navigate the tab to. Fully-qualified URLs must include a scheme (i.e., 'http://www.google.com', not 'www.google.com'). Relative URLs are relative to the current page within the extension. Defaults to the New Tab Page. 
- 
    windowIdnumber optional The window in which to create the new tab. Defaults to the current window. 
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(tab: Tab) => void - 
    tabThe created tab. 
 
- 
    
Returns
- 
            Promise<Tab> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
detectLanguage()
chrome.tabs.detectLanguage(
tabId?: number,
callback?: function,
): Promise<string>
Detects the primary language of the content in a tab.
Parameters
- 
    tabIdnumber optional Defaults to the active tab of the current window. 
- 
    callbackfunction optional The callbackparameter looks like:(language: string) => void - 
    languagestring An ISO language code such as enorfr. For a complete list of languages supported by this method, see kLanguageInfoTable. The second to fourth columns are checked and the first non-NULL value is returned, except for Simplified Chinese for whichzh-CNis returned. For an unknown/undefined language,undis returned.
 
- 
    
Returns
- 
            Promise<string> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
discard()
chrome.tabs.discard(
tabId?: number,
callback?: function,
): Promise<Tab | undefined>
Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated.
Parameters
- 
    tabIdnumber optional The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist. 
- 
    callbackfunction optional The callbackparameter looks like:(tab?: Tab) => void - 
    tabTab optional The discarded tab, if it was successfully discarded; undefined otherwise. 
 
- 
    
Returns
- 
            Promise<Tab | undefined> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
duplicate()
chrome.tabs.duplicate(
tabId: number,
callback?: function,
): Promise<Tab | undefined>
Duplicates a tab.
Parameters
- 
    tabIdnumber The ID of the tab to duplicate. 
- 
    callbackfunction optional The callbackparameter looks like:(tab?: Tab) => void 
Returns
- 
            Promise<Tab | undefined> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
executeScript()
chrome.tabs.executeScript(
tabId?: number,
details: InjectDetails,
callback?: function,
): Promise<any[] | undefined>
Replaced by scripting.executeScript in Manifest V3.
Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
Parameters
- 
    tabIdnumber optional The ID of the tab in which to run the script; defaults to the active tab of the current window. 
- 
    detailsDetails of the script to run. Either the code or the file property must be set, but both may not be set at the same time. 
- 
    callbackfunction optional The callbackparameter looks like:(result?: any[]) => void - 
    resultany[] optional The result of the script in every injected frame. 
 
- 
    
Returns
- 
            Promise<any[] | undefined> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
get()
chrome.tabs.get(
tabId: number,
callback?: function,
): Promise<Tab>
Retrieves details about the specified tab.
Parameters
- 
    tabIdnumber 
- 
    callbackfunction optional The callbackparameter looks like:(tab: Tab) => void - 
    tab
 
- 
    
Returns
- 
            Promise<Tab> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
getAllInWindow()
chrome.tabs.getAllInWindow(
windowId?: number,
callback?: function,
): Promise<Tab[]>
Please use tabs.query {windowId: windowId}.
Gets details about all tabs in the specified window.
Parameters
- 
    windowIdnumber optional Defaults to the current window. 
- 
    callbackfunction optional The callbackparameter looks like:(tabs: Tab[]) => void - 
    tabsTab[] 
 
- 
    
Returns
- 
            Promise<Tab[]> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
getCurrent()
chrome.tabs.getCurrent(
callback?: function,
): Promise<Tab | undefined>
Gets the tab that this script call is being made from. Returns undefined if called from a non-tab context (for example, a background page or popup view).
Parameters
Returns
- 
            Promise<Tab | undefined> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
getSelected()
chrome.tabs.getSelected(
windowId?: number,
callback?: function,
): Promise<Tab>
Please use tabs.query {active: true}.
Gets the tab that is selected in the specified window.
Parameters
- 
    windowIdnumber optional Defaults to the current window. 
- 
    callbackfunction optional The callbackparameter looks like:(tab: Tab) => void - 
    tab
 
- 
    
Returns
- 
            Promise<Tab> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
getZoom()
chrome.tabs.getZoom(
tabId?: number,
callback?: function,
): Promise<number>
Gets the current zoom factor of a specified tab.
Parameters
- 
    tabIdnumber optional The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window. 
- 
    callbackfunction optional The callbackparameter looks like:(zoomFactor: number) => void - 
    zoomFactornumber The tab's current zoom factor. 
 
- 
    
Returns
- 
            Promise<number> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
getZoomSettings()
chrome.tabs.getZoomSettings(
tabId?: number,
callback?: function,
): Promise<ZoomSettings>
Gets the current zoom settings of a specified tab.
Parameters
- 
    tabIdnumber optional The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window. 
- 
    callbackfunction optional The callbackparameter looks like:(zoomSettings: ZoomSettings) => void - 
    zoomSettingsThe tab's current zoom settings. 
 
- 
    
Returns
- 
            Promise<ZoomSettings> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
goBack()
chrome.tabs.goBack(
tabId?: number,
callback?: function,
): Promise<void>
Go back to the previous page, if one is available.
Parameters
- 
    tabIdnumber optional The ID of the tab to navigate back; defaults to the selected tab of the current window. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
goForward()
chrome.tabs.goForward(
tabId?: number,
callback?: function,
): Promise<void>
Go foward to the next page, if one is available.
Parameters
- 
    tabIdnumber optional The ID of the tab to navigate forward; defaults to the selected tab of the current window. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
group()
chrome.tabs.group(
options: object,
callback?: function,
): Promise<number>
Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group.
Parameters
- 
    optionsobject - 
    createPropertiesobject optional Configurations for creating a group. Cannot be used if groupId is already specified. - 
    windowIdnumber optional The window of the new group. Defaults to the current window. 
 
- 
    
- 
    groupIdnumber optional The ID of the group to add the tabs to. If not specified, a new group will be created. 
- 
    tabIdsnumber | [number, ...number[]] The tab ID or list of tab IDs to add to the specified group. 
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(groupId: number) => void - 
    groupIdnumber The ID of the group that the tabs were added to. 
 
- 
    
Returns
- 
            Promise<number> Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
highlight()
chrome.tabs.highlight(
highlightInfo: object,
callback?: function,
): Promise<windows.Window>
Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
Parameters
- 
    highlightInfoobject - 
    tabsnumber | number[] One or more tab indices to highlight. 
- 
    windowIdnumber optional The window that contains the tabs. 
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(window: Window) => void - 
    windowContains details about the window whose tabs were highlighted. 
 
- 
    
Returns
- 
            Promise<windows.Window> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
insertCSS()
chrome.tabs.insertCSS(
tabId?: number,
details: InjectDetails,
callback?: function,
): Promise<void>
Replaced by scripting.insertCSS in Manifest V3.
Injects CSS into a page. Styles inserted with this method can be removed with scripting.removeCSS. For details, see the programmatic injection section of the content scripts doc.
Parameters
- 
    tabIdnumber optional The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. 
- 
    detailsDetails of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
move()
chrome.tabs.move(
tabIds: number | number[],
moveProperties: object,
callback?: function,
): Promise<Tab | Tab[]>
Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
Parameters
- 
    tabIdsnumber | number[] The tab ID or list of tab IDs to move. 
- 
    movePropertiesobject - 
    indexnumber The position to move the window to. Use -1to place the tab at the end of the window.
- 
    windowIdnumber optional Defaults to the window the tab is currently in. 
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(tabs: Tab | Tab[]) => void 
Returns
- 
            Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
query()
chrome.tabs.query(
queryInfo: object,
callback?: function,
): Promise<Tab[]>
Gets all tabs that have the specified properties, or all tabs if no properties are specified.
Parameters
- 
    queryInfoobject - 
    activeboolean optional Whether the tabs are active in their windows. 
- 
    audibleboolean optional Chrome 45+Whether the tabs are audible. 
- 
    autoDiscardableboolean optional Chrome 54+Whether the tabs can be discarded automatically by the browser when resources are low. 
- 
    currentWindowboolean optional Whether the tabs are in the current window. 
- 
    discardedboolean optional Chrome 54+Whether the tabs are discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content is reloaded the next time it is activated. 
- 
    frozenboolean optional Chrome 132+Whether the tabs are frozen. A frozen tab cannot execute tasks, including event handlers or timers. It is visible in the tab strip and its content is loaded in memory. It is unfrozen on activation. 
- 
    groupIdnumber optional Chrome 88+The ID of the group that the tabs are in, or tabGroups.TAB_GROUP_ID_NONEfor ungrouped tabs.
- 
    highlightedboolean optional Whether the tabs are highlighted. 
- 
    indexnumber optional The position of the tabs within their windows. 
- 
    lastFocusedWindowboolean optional Whether the tabs are in the last focused window. 
- 
    mutedboolean optional Chrome 45+Whether the tabs are muted. 
- 
    pinnedboolean optional Whether the tabs are pinned. 
- 
    splitViewIdnumber optional Chrome 140+The ID of the Split View that the tabs are in, or tabs.SPLIT_VIEW_ID_NONEfor tabs that aren't in a Split View.
- 
    statusTabStatus optional The tab loading status. 
- 
    titlestring optional Match page titles against a pattern. This property is ignored if the extension does not have the "tabs"permission or host permissions for the page.
- 
    urlstring | string[] optional Match tabs against one or more URL patterns. Fragment identifiers are not matched. This property is ignored if the extension does not have the "tabs"permission or host permissions for the page.
- 
    windowIdnumber optional The ID of the parent window, or windows.WINDOW_ID_CURRENTfor the current window.
- 
    windowTypeWindowType optional The type of window the tabs are in. 
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(result: Tab[]) => void - 
    resultTab[] 
 
- 
    
Returns
- 
            Promise<Tab[]> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
reload()
chrome.tabs.reload(
tabId?: number,
reloadProperties?: object,
callback?: function,
): Promise<void>
Reload a tab.
Parameters
- 
    tabIdnumber optional The ID of the tab to reload; defaults to the selected tab of the current window. 
- 
    reloadPropertiesobject optional - 
    bypassCacheboolean optional Whether to bypass local caching. Defaults to false.
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
remove()
chrome.tabs.remove(
tabIds: number | number[],
callback?: function,
): Promise<void>
Closes one or more tabs.
Parameters
- 
    tabIdsnumber | number[] The tab ID or list of tab IDs to close. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
removeCSS()
chrome.tabs.removeCSS(
tabId?: number,
details: DeleteInjectionDetails,
callback?: function,
): Promise<void>
Replaced by scripting.removeCSS in Manifest V3.
Removes from a page CSS that was previously injected by a call to scripting.insertCSS.
Parameters
- 
    tabIdnumber optional The ID of the tab from which to remove the CSS; defaults to the active tab of the current window. 
- 
    detailsDetails of the CSS text to remove. Either the code or the file property must be set, but both may not be set at the same time. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
sendMessage()
chrome.tabs.sendMessage(
tabId: number,
message: any,
options?: object,
callback?: function,
): Promise<any>
Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
Parameters
- 
    tabIdnumber 
- 
    messageany The message to send. This message should be a JSON-ifiable object. 
- 
    optionsobject optional 
- 
    callbackfunction optional Chrome 99+The callbackparameter looks like:(response: any) => void - 
    responseany The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback is called with no arguments and runtime.lastErroris set to the error message.
 
- 
    
Returns
- 
            Promise<any> Chrome 99+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
sendRequest()
chrome.tabs.sendRequest(
tabId: number,
request: any,
callback?: function,
): Promise<any>
Please use runtime.sendMessage.
Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension.
Parameters
- 
    tabIdnumber 
- 
    requestany 
- 
    callbackfunction optional Chrome 99+The callbackparameter looks like:(response: any) => void - 
    responseany The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback is called with no arguments and runtime.lastErroris set to the error message.
 
- 
    
Returns
- 
            Promise<any> Chrome 99+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
setZoom()
chrome.tabs.setZoom(
tabId?: number,
zoomFactor: number,
callback?: function,
): Promise<void>
Zooms a specified tab.
Parameters
- 
    tabIdnumber optional The ID of the tab to zoom; defaults to the active tab of the current window. 
- 
    zoomFactornumber The new zoom factor. A value of 0sets the tab to its current default zoom factor. Values greater than0specify a (possibly non-default) zoom factor for the tab.
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
setZoomSettings()
chrome.tabs.setZoomSettings(
tabId?: number,
zoomSettings: ZoomSettings,
callback?: function,
): Promise<void>
Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
Parameters
- 
    tabIdnumber optional The ID of the tab to change the zoom settings for; defaults to the active tab of the current window. 
- 
    zoomSettingsDefines how zoom changes are handled and at what scope. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
ungroup()
chrome.tabs.ungroup(
tabIds: number | [number, ...number[]],
callback?: function,
): Promise<void>
Removes one or more tabs from their respective groups. If any groups become empty, they are deleted.
Parameters
- 
    tabIdsnumber | [number, ...number[]] The tab ID or list of tab IDs to remove from their respective groups. 
- 
    callbackfunction optional The callbackparameter looks like:() => void 
Returns
- 
            Promise<void> Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
update()
chrome.tabs.update(
tabId?: number,
updateProperties: object,
callback?: function,
): Promise<Tab | undefined>
Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified.
Parameters
- 
    tabIdnumber optional Defaults to the selected tab of the current window. 
- 
    updatePropertiesobject - 
    activeboolean optional Whether the tab should be active. Does not affect whether the window is focused (see windows.update).
- 
    autoDiscardableboolean optional Chrome 54+Whether the tab should be discarded automatically by the browser when resources are low. 
- 
    highlightedboolean optional Adds or removes the tab from the current selection. 
- 
    mutedboolean optional Chrome 45+Whether the tab should be muted. 
- 
    openerTabIdnumber optional The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. 
- 
    pinnedboolean optional Whether the tab should be pinned. 
- 
    selectedboolean optional DeprecatedPlease use highlighted. Whether the tab should be selected. 
- 
    urlstring optional A URL to navigate the tab to. JavaScript URLs are not supported; use scripting.executeScriptinstead.
 
- 
    
- 
    callbackfunction optional The callbackparameter looks like:(tab?: Tab) => void 
Returns
- 
            Promise<Tab | undefined> Chrome 88+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
Events
onActivated
chrome.tabs.onActivated.addListener(
callback: function,
)
Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events so as to be notified when a URL is set.
Parameters
- 
    callbackfunction The callbackparameter looks like:(activeInfo: object) => void - 
    activeInfoobject - 
    tabIdnumber The ID of the tab that has become active. 
- 
    windowIdnumber The ID of the window the active tab changed inside of. 
 
- 
    
 
- 
    
onActiveChanged
chrome.tabs.onActiveChanged.addListener(
callback: function,
)
Please use tabs.onActivated.
Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events so as to be notified when a URL is set.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, selectInfo: object) => void - 
    tabIdnumber 
- 
    selectInfoobject - 
    windowIdnumber The ID of the window the selected tab changed inside of. 
 
- 
    
 
- 
    
onAttached
chrome.tabs.onAttached.addListener(
callback: function,
)
Fired when a tab is attached to a window; for example, because it was moved between windows.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, attachInfo: object) => void - 
    tabIdnumber 
- 
    attachInfoobject - 
    newPositionnumber 
- 
    newWindowIdnumber 
 
- 
    
 
- 
    
onCreated
chrome.tabs.onCreated.addListener(
callback: function,
)
Fired when a tab is created. Note that the tab's URL and tab group membership may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set or the tab is added to a tab group.
onDetached
chrome.tabs.onDetached.addListener(
callback: function,
)
Fired when a tab is detached from a window; for example, because it was moved between windows.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, detachInfo: object) => void - 
    tabIdnumber 
- 
    detachInfoobject - 
    oldPositionnumber 
- 
    oldWindowIdnumber 
 
- 
    
 
- 
    
onHighlightChanged
chrome.tabs.onHighlightChanged.addListener(
callback: function,
)
Please use tabs.onHighlighted.
Fired when the highlighted or selected tabs in a window changes.
Parameters
- 
    callbackfunction The callbackparameter looks like:(selectInfo: object) => void - 
    selectInfoobject - 
    tabIdsnumber[] All highlighted tabs in the window. 
- 
    windowIdnumber The window whose tabs changed. 
 
- 
    
 
- 
    
onHighlighted
chrome.tabs.onHighlighted.addListener(
callback: function,
)
Fired when the highlighted or selected tabs in a window changes.
Parameters
- 
    callbackfunction The callbackparameter looks like:(highlightInfo: object) => void - 
    highlightInfoobject - 
    tabIdsnumber[] All highlighted tabs in the window. 
- 
    windowIdnumber The window whose tabs changed. 
 
- 
    
 
- 
    
onMoved
chrome.tabs.onMoved.addListener(
callback: function,
)
Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response to the manually-moved tab. This event is not fired when a tab is moved between windows; for details, see tabs.onDetached.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, moveInfo: object) => void - 
    tabIdnumber 
- 
    moveInfoobject - 
    fromIndexnumber 
- 
    toIndexnumber 
- 
    windowIdnumber 
 
- 
    
 
- 
    
onRemoved
chrome.tabs.onRemoved.addListener(
callback: function,
)
Fired when a tab is closed.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, removeInfo: object) => void - 
    tabIdnumber 
- 
    removeInfoobject - 
    isWindowClosingboolean True when the tab was closed because its parent window was closed. 
- 
    windowIdnumber The window whose tab is closed. 
 
- 
    
 
- 
    
onReplaced
chrome.tabs.onReplaced.addListener(
callback: function,
)
Fired when a tab is replaced with another tab due to prerendering or instant.
Parameters
- 
    callbackfunction The callbackparameter looks like:(addedTabId: number, removedTabId: number) => void - 
    addedTabIdnumber 
- 
    removedTabIdnumber 
 
- 
    
onSelectionChanged
chrome.tabs.onSelectionChanged.addListener(
callback: function,
)
Please use tabs.onActivated.
Fires when the selected tab in a window changes.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, selectInfo: object) => void - 
    tabIdnumber 
- 
    selectInfoobject - 
    windowIdnumber The ID of the window the selected tab changed inside of. 
 
- 
    
 
- 
    
onUpdated
chrome.tabs.onUpdated.addListener(
callback: function,
)
Fired when a tab is updated.
Parameters
- 
    callbackfunction The callbackparameter looks like:(tabId: number, changeInfo: object, tab: Tab) => void - 
    tabIdnumber 
- 
    changeInfoobject - 
    audibleboolean optional Chrome 45+The tab's new audible state. 
- 
    autoDiscardableboolean optional Chrome 54+The tab's new auto-discardable state. 
- 
    discardedboolean optional Chrome 54+The tab's new discarded state. 
- 
    favIconUrlstring optional The tab's new favicon URL. 
- 
    frozenboolean optional Chrome 132+The tab's new frozen state. 
- 
    groupIdnumber optional Chrome 88+The tab's new group. 
- 
    mutedInfoMutedInfo optional Chrome 46+The tab's new muted state and the reason for the change. 
- 
    pinnedboolean optional The tab's new pinned state. 
- 
    splitViewIdnumber optional Chrome 140+The tab's new Split View. 
- 
    statusTabStatus optional The tab's loading status. 
- 
    titlestring optional Chrome 48+The tab's new title. 
- 
    urlstring optional The tab's URL if it has changed. 
 
- 
    
- 
    tab
 
- 
    
onZoomChange
chrome.tabs.onZoomChange.addListener(
callback: function,
)
Fired when a tab is zoomed.
Parameters
- 
    callbackfunction The callbackparameter looks like:(ZoomChangeInfo: object) => void - 
    ZoomChangeInfoobject - 
    newZoomFactornumber 
- 
    oldZoomFactornumber 
- 
    tabIdnumber 
- 
    zoomSettings
 
- 
    
 
-