I am currently working on a Chrome extension where I need to display an alert() showing the page URL whenever the user switches tabs or enters a new URL in a tab.
However, my current implementation is not functioning as expected:
chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab) {
alert(changeInfo.url);
});
chrome.tabs.onActivated.addListener(function(object activeInfo) {
// Additionally, provide guidance on how to retrieve the tab URL using activeInfo.tabid
});