I’m writing an extension which needs to collect all the ids of newly created tabs.
Using this snippet, I’m able to get an id of a tab that is created by just clicking “Add a new tab”, as the browser autmatically displays it.
chrome.tabs.onCreated.addListener(() => {
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
tabs.push(tab.id);
});
But what I’m struggling with, is to get the id of a tab that is created when you select to open a link in a new tab, as it doesn’t set it as an active one, but rather stays on the same tab. Is there any option to get that?
Thanks.