MDN self-hosted library · e01.org

tabGroups.onMoved

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
function tabGroupMoved(group) {
  console.log(
    `Tab group with ID ${group.id} was moved to window ${group.windowId}.`,
  );
}

browser.tabGroups.onMoved.addListener(tabGroupMoved);
js
browser.tabGroups.onMoved.addListener(async (group) => {
  let tabs = await browser.tabs.query({
    groupId: group.id,
  });
  console.log(
    `Moved tab group to ${tabs[0].index} in window ${group.windowId}`,
  );
});