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>