In my Google Chrome extension page I have a content script that injects a script when a particular URL is matched.
I'm trying to get some info about the tab that it's injected into so that I can do some cleanup when the tab gets closed.
To this end, I've tried calling chrome.tabs.getCurrent()
from within the injected script. However, it returns undefined
, which is weird because in the API it says that getCurrent()
's return
May be undefined if called from a non-tab context (for example: a background page or popup view).
and I'm calling it from within the tab...
Where am I going wrong?