I have an extension that will work only on a given url and I'm using the declarativeContent
api to achieve this. When the extension icon is clicked a new popup window that will hold the popup.html will be opened.
I need a way to get the url of the tab that have opened the popup from the popup.js file, I've with chrome.tabs.query
but I will get always undefined. Is there a better way?
chrome.tabs.query({
active: true,
lastFocusedWindow: true,
url: 'https://example.com/*' }, (tab) =>{
console.log(tab) // undefined
})