I can't find any working code since getSelected is depreciated. But can anyone help me with how to achieve this?
chrome.action.onClicked.addListener((tab: chrome.tabs.Tab) => {
const urlTab: string = tab.url as string;
console.log(urlTab)
});
chrome.tabs.onActivated.addListener((activeInfo: chrome.tabs.TabActiveInfo) => {
const tabId: number = activeInfo.tabId;
chrome.tabs.get(tabId, (tab: chrome.tabs.Tab) => {
const urlTab: string = tab.url as string;
console.log(urlTab)
});
});
If I have this in background.js, how can I pass the urlTab in popup.js? Thank you for helping me.