I’m doing a chrome extension, and there is in the doc this statement about chrome.tabs.onActivated.
Whenever I try to place chrome.tabs.onActivated.addListener, it says Uncaught TypeError: Cannot call method 'addListener' of undefined.
The whole background.html :
<script>
chrome.tabs.onActivated.addListener(function(info) {
var tab = chrome.tabs.get(info.tabId, function(tab) {
localStorage["current_url"] = tab.url;
});
});
</script>
The documentation is incomplete. As of Chrome 18,
chrome.tabs.onActiveChangedis replaced withchrome.tabs.onActivated. In Chrome 17, theonActivatedevent did not exist.I obtained this function name by opening the console in the context of an extension, and inspecting the keys of
chrome.tabs.