Skip to content

Instantly share code, notes, and snippets.

@jlewin
Last active March 7, 2023 17:21
Show Gist options
  • Save jlewin/5343915 to your computer and use it in GitHub Desktop.
Save jlewin/5343915 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);
});
@SmartManoj
Copy link

extension page

I used Tampermonkey

@edmontdants
Copy link

OMG... I have 174 tabs open right now :O

r u kidding i've 2226 tab opened right now in 68 window one of them have 174 opened tab 😂

@Farbod29
Copy link

Farbod29 commented Sep 8, 2021

Thanks all esp, @jlewin @hfaran @rwilhelm really cool solutions all worked for me I made all solution + event listener that when the user open the new tab it counts all together in a simple Chrome Extension under this GitHub links 👍 +1
Link:
https://github.com/Farbod29/extract-and-find-the-new-tab-frome-the-browser-with-chrome-extention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment