tabs.duplicate()

Duplicates a tab, given its ID.

Syntax

chrome.tabs.duplicate(
  tabId,              // integer
  function(tab) {...} // optional function
)

This API is also available as browser.tabs.duplicate() in a version that returns a promise.

Parameters

tabId
integer. The ID of the tab which is to be duplicated.
callbackOptional
function. The function is passed the following arguments:
tabOptional
tabs.Tab. Details about the duplicated tab. The tabs.Tab object only contains url, title and favIconUrl if the extension has the "tabs" permission.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 47.0 No 33

Examples

Duplicate the first tab, and then log the ID of the newly created tab:

function onDuplicated(tabInfo) {
  console.log(tabInfo.id);
} 

// Duplicate the first tab in the array
function duplicateFirstTab(tabs) {console.log(tabs);
  if (tabs.length > 0) {
    chrome.tabs.duplicate(tabs[0].id, onDuplicated);
  }
}

// Query for all open tabs
chrome.tabs.query({}, duplicateFirstTab);

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.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

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