Skip to content

Instantly share code, notes, and snippets.

@rxw1
Forked from jlewin/countTabs.js
Created June 23, 2014 22:26
Show Gist options
  • Save rxw1/03d542dd401e526db53e to your computer and use it in GitHub Desktop.
Save rxw1/03d542dd401e526db53e to your computer and use it in GitHub Desktop.

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