26

While using Firefox I want to keep tabs on the number of open tabs (pun intended). Is there a way to quickly get this number while using the browser?

In older versions of Firefox there was a pop up message box "You are going to close 428 tabs. Are you sure you want to proceed?" showing when you attempt to close the browser window. However in the later versions (I am running Firefox 102) it does not show up any more.

On this site I found a related post with an answer for Google Chrome browser that uses Google sync function to get this number by typing a special url in the location string.

There is also a related post on Stack Overflow but the solutions there tend to require some scripting or enabling developer tools that are disabled by default.

What would be an easy way to get the number of currently open tabs in Firefox?

Destroy666
  • 12,350

6 Answers6

32

There are ways to count tabs without any extensions, but they're less comfortable or require manual changes. For example:

  • Right mouse button on a tab -> Select All Tabs -> Right mouse button on a tab again -> there will be Close X button with the number of opened tabs.

  • you could modify the V ("List all tabs") dropdown button to include tab count with custom styling:
#TabsToolbar-customization-target {  
  counter-reset: tabCount;  
}

.tabbrowser-tab {
counter-increment: tabCount;
}

#alltabs-button > .toolbarbutton-badge-stack > .toolbarbutton-icon {
visibility: collapse !important;
}

#alltabs-button > .toolbarbutton-badge-stack {
position: relative !important;
}

#alltabs-button > .toolbarbutton-badge-stack::before {
content: counter(tabCount);
border-bottom: 1px solid var(--toolbarbutton-icon-fill);
color: var(--toolbarbutton-icon-fill);
opacity: var(--toolbarbutton-icon-fill-opacity);
position: absolute;
bottom: var(--toolbarbutton-inner-padding);
left: 50%;
transform: translateX(-50%);
padding: 0 3px;
}

Check e.g. this answer to learn how to apply the styling.

Destroy666
  • 12,350
17

Enable the command line of the Browser Console. Execute the following snippet.

(()=>{
  const { ExtensionParent } = ChromeUtils.importESModule("resource://gre/modules/ExtensionParent.sys.mjs");
  const { tabTracker } = ExtensionParent.apiManager.global;
  console.log(tabTracker._tabIds.size)
})();

NB: The Browser Console command line (to execute JavaScript expressions) is disabled by default. To enable it set the devtools.chrome.enabled preference to true in about:config, or set the “Enable browser chrome and add-on debugging toolboxes” (Firefox 40 and later) option in the developer tool settings.

paa
  • 972
7

One approach is to re-enable the Firefox 93 behaviour of warning when you close a window with multiple tabs. The setting for this can be found in the Tabs section of the General settings; simply tick the "Confirm before closing multiple tabs" checkbox.

Neil
  • 889
3

You can easily check this in the browser's console, which is accessed by hitting ctrl-shift-j(if nothing pops up when you press this, you might have to enable the console by going to about:config and setting devtools.chrome.enabled to true)
The command to get a count of open tabs is gBrowser.tabs.length:
enter image description here

2

This requires an add-on. See the following:

  • Tab Counter
    Add a badge to the toolbar that shows the number of currently open tabs in a window or all windows.

  • Tab Counter Plus
    Shows the number of tabs in each window. Efficient and customizable.

harrymc
  • 498,455
2

Edit: This is to check how many tabs Firefox has open in total. My apologies, I misread the question.

I think maybe you don't need any extensions or code now. You can go to about:telemetry#scalars-tab_search=tab as if it were a regular url and look at the "browser.engagement.max_concurrent_tab_count" property. I think the value next to that should be the number of tabs you have open.

Let me know if I'm misunderstanding what that value means.

Mixchange
  • 121