function onUpdated(tab) {
console.log(`Updated tab: ${tab.id}`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
let updating = browser.tabs.update({ url: "https://developer.mozilla.org" });
updating.then(onUpdated, onError);tabs.update() / notebook
tabs.update()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function onUpdated(tab) {
console.log(`Updated tab: ${tab.id}`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
function updateFirstTab(tabs) {
let updating = browser.tabs.update(tabs[0].id, {
active: true,
url: "https://developer.mozilla.org",
});
updating.then(onUpdated, onError);
}
let querying = browser.tabs.query({ currentWindow: true });
querying.then(updateFirstTab, onError);