Basically, I want to get all the opened tabs of the browser window, from within a tab, more specifically, in content script.
I tried chrome.tabs.query
, it works in background script, but doesn't work in content script.
So my questions are:
Is there a way to do such work? Maybe an API that I wasn't aware of?
Or, can I dispatch an event from content script, then capture the event in background script, and vice versa?
Or, is it just impossible?
According to https://developer.chrome.com/extensions/content_scripts , a content script cannot access chrome.* APIs, except a few allowed ones but chrome.tabs is not among them
Exchanging messages with the parent script is possible, though, so this might be the way to do it. See https://developer.chrome.com/extensions/messaging