tabs.onUpdated

Fired when a tab is updated.

When the user navigates to a new URL in a tab, this typically generates several onUpdated events as various properties of the tabs.Tab object are updated. This includes the url, but also potentially the title and favIconUrl properties. The status property will cycle through "loading" and "complete".

This event also fires for changes to a tab's properties that don't involve navigation, such as pinning and unpinning (which updates the pinned property) and muting or unmuting (which updates the audible and mutedInfo properties).

You can filter this event, making it only fire for tabs whose URLs match specific patterns, changes to particular properties, changes to a tab or window, or any combinations of these restrictions.

Syntax

js
browser.tabs.onUpdated.addListener(
  listener, // function
  filter     // optional object
)
browser.tabs.onUpdated.removeListener(listener)
browser.tabs.onUpdated.hasListener(listener)

Events have three functions:

addListener(callback, filter)

Adds a listener to this event.

removeListener(listener)

Stop listening to this event. The listener argument is the listener to remove.

hasListener(listener)

Check whether listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

listener

The function called when this event occurs. The function is passed these arguments:

tabId

integer. The ID of the updated tab.

changeInfo

object. Properties of the tab that changed. See the changeInfo section for more details.

tab

tabs.Tab. The new state of the tab.

filter Optional

object. A set of filters that restrict the events sent to this listener. This object can have one or more of these properties. Events are only sent if they satisfy all the filters provided.

urls

Array. An array of match patterns. Fires the event only for tabs whose current url property matches any one of the patterns.

properties

Array. An array of strings consisting of supported tabs.Tab object property names. Fires the event only for changes to one of the properties named in the array. These properties can be used:

  • "attention"
  • "autoDiscardable"
  • "audible"
  • "discarded"
  • "favIconUrl"
  • "groupId"
  • "hidden"
  • "isArticle"
  • "mutedInfo"
  • "openerTabId"
  • "pinned"
  • "splitViewId"
  • "status"
  • "title"
  • "url"

Note: The "url" value has been supported since Firefox 88. In Firefox 87 and earlier, "url" changes can be observed by filtering by "status".

tabId

Integer. Fires this event only for the tab identified by this ID.

windowId

Integer. Fires this event only for tabs in the window identified by this ID.

cookieStoreId

Integer. Fires this event only for tabs in the cookie store identified by this ID.

Additional objects

changeInfo

Lists the changes to the state of the tab that is updated. To learn more about these properties, see the tabs.Tab documentation. Note that not all tabs.Tab properties are supported.

attention Optional

boolean. Indicates whether the tab is drawing attention. For example, attention is true when the tab displays a modal dialog.

audible Optional

boolean. The tab's new audible state.

autoDiscardable Optional

boolean. Whether the tab can be discarded by the browser. The default value is true. When set to false, the browser cannot automatically discard the tab. However, the tab can be discarded by tabs.discard.

discarded Optional

boolean. Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory but is visible in the tab strip. Its content gets reloaded the next time it's activated.

favIconUrl Optional

string. The tab's new favicon URL. Not included when a tab loses its favicon (navigating from a page with a favicon to a page without one). Check favIconUrl in tab instead.

groupId Optional

integer. The ID of the group the tabs are in or -1 (tabGroups.TAB_GROUP_ID_NONE) for ungrouped tabs.

hidden Optional

boolean. True if the tab is hidden.

isArticle Optional

boolean. True if the tab is an article and is therefore eligible for display in Reader Mode.

mutedInfo Optional

tabs.MutedInfo. The tab's new muted state and the reason for the change.

openerTabId Optional

integer. The ID of the tab that opened this tab, if any. This property is only present if the opener tab exists and is in the same window.

pinned Optional

boolean. The tab's new pinned state.

splitViewId Optional

integer. The ID of the split view the tab belongs to. Set to tabs.SPLIT_VIEW_ID_NONE when the tab doesn't belong to a split view.

status Optional

string. The status of the tab. Can be either loading or complete.

title Optional

string. The tab's new title.

url Optional

string. The tab's URL, if it has changed.

Examples

Listen for and log all the change info and new state:

js
function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

browser.tabs.onUpdated.addListener(handleUpdated);

Log changes to URLs:

js
function handleUpdated(tabId, changeInfo, tabInfo) {
  if (changeInfo.url) {
    console.log(`Tab: ${tabId} URL changed to ${changeInfo.url}`);
  }
}

browser.tabs.onUpdated.addListener(handleUpdated);

Filtering examples

Log changes only to tabs whose url property is matched by https://developer.mozilla.org/* or https://mastodon.social/@mdn:

js
const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";

const filter = {
  urls: [pattern1, pattern2],
};

function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

browser.tabs.onUpdated.addListener(handleUpdated, filter);

Log changes only to the pinned property of tabs (that is, pin and unpin actions):

js
const filter = {
  properties: ["pinned"],
};

function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

browser.tabs.onUpdated.addListener(handleUpdated, filter);

Combine both the previous filters, log only when the pinned property of tabs changes for tabs whose url property is matched by https://developer.mozilla.org/* or https://mastodon.social/@mdn:

js
const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";

const filter = {
  urls: [pattern1, pattern2],
  properties: ["pinned"],
};

function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

browser.tabs.onUpdated.addListener(handleUpdated, filter);

Log changes only when the pinned property of tabs changes for tabs whose url property is matched by https://developer.mozilla.org/* or https://mastodon.social/@mdn where the tab was part of the current browser window when the update event fired:

js
const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";

const filter = {
  urls: [pattern1, pattern2],
  properties: ["pinned"],
  windowId: browser.windows.WINDOW_ID_CURRENT,
};

function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

browser.tabs.onUpdated.addListener(handleUpdated, filter);

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
onUpdated
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
changeInfo
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
changeInfo.audible
Chrome – Full support
Chrome 45 (Release date: 2015-09-01)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 32 (Release date: 2015-09-15)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
changeInfo.autoDiscardable
Chrome – Full support
Chrome 54 (Release date: 2016-10-12)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 116 (Release date: 2023-08-01)
footnote Full support
Opera – Full support
Opera 41 (Release date: 2016-10-25)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 265970
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 265970
changeInfo.discarded
Chrome – Full support
Chrome 54 (Release date: 2016-10-12)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 57 (Release date: 2017-11-14)
footnote Full support
Opera – Full support
Opera 41 (Release date: 2016-10-25)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android 57 – 68 (Release date: 2017-11-28)
footnote Removed in 79 and later
Safari on iOS – No support
Safari on iOS
footnote No support
changeInfo.favIconUrl
Chrome – Full support
Chrome 27 (Release date: 2013-05-21)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
changeInfo.groupId
Chrome – Full support
Chrome 88 (Release date: 2021-01-19)
footnote Full support
Edge – Full support
Edge 88 (Release date: 2021-01-21)
footnote Full support
Firefox – Full support
Firefox 138 (Release date: 2025-04-29)
footnote Full support
Opera – Full support
Opera 74 (Release date: 2021-02-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
changeInfo.mutedInfo
Chrome – Full support
Chrome 46 (Release date: 2015-10-13)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 33 (Release date: 2015-10-27)
footnote Full support
Safari – Partial support
Safari 14 (Release date: 2020-09-16)
footnote Partial support
footnote reason and extensionId will not be populated.
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
changeInfo.openerTabId
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 131 (Release date: 2024-10-01)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 131 (Release date: 2024-10-01)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
changeInfo.pinned
Chrome – Full support
Chrome 9 (Release date: 2011-02-03)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – No support
Firefox for Android 54 – 68 (Release date: 2017-06-13)
footnote Removed in 79 and later
Safari on iOS – Full support
Safari on iOS 16 (Release date: 2022-09-12)
footnote Full support
changeInfo.splitViewId
Chrome – Full support
Chrome 140 (Release date: 2025-09-02)
footnote Full support
Edge – Full support
Edge 140 (Release date: 2025-09-05)
footnote Full support
Firefox – Full support
Firefox 149 (Release date: 2026-03-24)
footnote Full support
Opera – Full support
Opera 124 (Release date: 2025-11-13)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
changeInfo.status
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
changeInfo.title
Chrome – Full support
Chrome 48 (Release date: 2016-01-20)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 53 (Release date: 2017-04-19)
footnote Full support
Opera – Full support
Opera 35 (Release date: 2016-02-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote
footnote Requires host permissions for the tab, otherwise is an empty string.
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote
footnote Requires host permissions for the tab, otherwise is an empty string.
changeInfo.url
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote
footnote Requires host permissions for the tab, otherwise is an empty string.
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote
footnote Requires host permissions for the tab, otherwise is an empty string.
filter
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 61 (Release date: 2018-06-26)
footnote
footnote Support for openTabID in properties added in Firefox 131.
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
filter.cookieStoreId
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 141 (Release date: 2025-07-22)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
filter.properties
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 61 (Release date: 2018-06-26)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
properties.groupId
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 138 (Release date: 2025-04-29)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
properties.isArticle
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 61 – 70 (Release date: 2018-06-26)
altname
footnote Removed in 71 and later
altname Alternate name: isarticle
Firefox – Full support
Firefox 62 (Release date: 2018-09-05)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
properties.splitViewId
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 149 (Release date: 2026-03-24)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Uses a non-standard name
Has more compatibility info.

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