Is there a key switch event for google chrome extension?

Like google chrome extension, is it possible to listen to tab switchers? That is, to be notified of what just happened with the tab switch?

(I want to make an extension that in full screen mode when switching tabs with the usual keys Ctrl+PageUp and Ctrl+PageDown gives visual feedback from the switch and other currently available tabs.)

+4
source share
2 answers

In the manifest.json file, add the following:

 "permissions":[ "background", "tabs" ], "background" : { "scripts": ["scripts/background.js"], "persistent": false } 

In your background.js:

 chrome.tabs.onActivated.addListener(function(activeInfo) { console.log(activeInfo.tabId); 

});

0
source

Source: https://habr.com/ru/post/1497041/


All Articles