function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated);tabs.onUpdated / notebook
tabs.onUpdated
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function handleUpdated(tabId, changeInfo, tabInfo) {
if (changeInfo.url) {
console.log(`Tab: ${tabId} URL changed to ${changeInfo.url}`);
}
}
browser.tabs.onUpdated.addListener(handleUpdated);const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";
const filter = {
urls: [pattern1, pattern2],
};
function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated, filter);const filter = {
properties: ["pinned"],
};
function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated, filter);const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";
const filter = {
urls: [pattern1, pattern2],
properties: ["pinned"],
};
function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated, filter);const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://mastodon.social/@mdn";
const filter = {
urls: [pattern1, pattern2],
properties: ["pinned"],
windowId: browser.windows.WINDOW_ID_CURRENT,
};
function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated, filter);