Skip to content

Instantly share code, notes, and snippets.

@m0zgen
Forked from jlewin/countTabs.js
Last active September 17, 2015 09:50
Show Gist options
  • Save m0zgen/309bb40d1c95156097f5 to your computer and use it in GitHub Desktop.
Save m0zgen/309bb40d1c95156097f5 to your computer and use it in GitHub Desktop.
Count of open tabs in Chrome

A quick technique to determine how many tabs are open in Chrome. After a bit of searching I couldn't find any useful solutions and didn't really want to install an extension to see my tab count. This approach uses the chrome.windows module to access the required info and thus must be run from an environment with the appropriate permissions. As such, it's simply a matter of co-opting any extensions background page and executing the script...

Usage

  1. Open the Extensions page; ala chrome://extensions/
  • Inspect the background page of any extension that has the Access Tabs permission
  • Switch to the console tab and execute the included script
  • Review the array of Window objects and their 'tabs' property for the tab count and additional details
chrome.windows.getAll({populate: true}, function(allWindows)
{
console.log(allWindows);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment