I'm trying to use the browser APIs to get the current url, so that I can decide create a context menu if it's a certain URL.
I've seen a similar question on here but it doesn't seem to do what I'm expecting.
When using the tabs.query
method, it always logs the same tab into the console (I have permissions added).
browser.tabs.query({currentWindow: true, active: true})
.then(tabs => {
let tab = tabs[0];
console.log(tab);
})
.catch(err => {
console.error(err);
});
I would expect this to log a different tab to the console as I move from one tab to the next. Am I missing something?