Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Tab highlighting API for extensions

  • I'm wondering how to find which tabs are currently 'highlighted,' as when using shift+click or control+click on tabs to create a selection of multiple tabs.

    The Opera.Dev page has the following "Working With Tabs and Windows" page that explicitly lists 'highlighting' as one of the functionalities that is supported with the chrome.tabs API.

    Yet, when using chrome.tabs.query, every tab result always returns 'false' for the 'highlighted' field making it impossible to determine what the current selection is. I thought that perhaps this would be relegated to the 'selected' field instead, but 'selected' only ever appears 'true' for the currently active tab rather than all within the highlighted selection.

    Here is some example code:

    chrome.tabs.query({currentWindow: true}, function(tabs) {
         tabs.forEach(function(tab) {
              window.console.log('Tab ID: ' + + "\t Highlighted: " + tab.highlighted 
                   + "\t Selected: " + tab.selected);

    Regardless of selection, it always produces 'highlighted' as being false.

    Am I missing something, or is there some other way to go about finding the current highlighted selection?

    Thank you.