chrome.tabs.onUpdated.addListener(。。

 注意使用chrome.tabs.onUpdated.addListener需要在manifest.json声明tabs权限

permissions: [‘tabs’]

function handleUpdated(tabId, changeInfo, tabInfo) {
  console.log(`Updated tab: ${tabId}`);
  console.log("Changed attributes: ", changeInfo);
  console.log("New tab Info: ", tabInfo);
}

chrome.tabs.onUpdated.addListener(handleUpdated);

  或者

chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { 
  alert(tabId); 
});

  

posted @ 2022-11-14 22:52  uuxyz  阅读(123)  评论(0)    收藏  举报
联系我