function onDuplicated(tabInfo) {
console.log(tabInfo.id);
}
function onError(error) {
console.log(`Error: ${error}`);
}
// Duplicate the first tab in the array
function duplicateFirstTab(tabs) {
console.log(tabs);
if (tabs.length > 0) {
let duplicating = browser.tabs.duplicate(tabs[0].id);
duplicating.then(onDuplicated, onError);
}
}
// Query for all open tabs
let querying = browser.tabs.query({});
querying.then(duplicateFirstTab, onError);tabs.duplicate() / notebook
tabs.duplicate()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.