Navigate the active tab in the current window to https://developer.mozilla.org:
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);
Activate the first tab in the current window, and navigate it to https://developer.mozilla.org:
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);