Ever Wondered How Many Firefox Tabs You Have Open?
To find out, open Tools > Error Console, and copy and paste this lump of javascript into the “code” box and press enter:
javascript:var w=Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getEnumerator('navigator:browser'),t=0;while(w.hasMoreElements())t+=w.getNext().document.getElementById("content").mTabs.length;alert("You have "+t+" tabs open");
I’ve just closed 48 tabs, and found that there was still loads of tabs open (and I didn’t want to continue counting) so I wrote this code (inspired by Open Tab Count firefox extension) and found I had 77 still open! For those of you who’s mental arithmetic is poor, that’s a total of 125 tabs! And firefox 3 still runs really smoothly with little delay when changing tabs, and my system is using less than 2 GB of it’s available 4GB of RAM. Now, I think that’s pretty impressive, and would like to see Google Chrome compete with that with it’s one-process-per-tab design! (If only FF3s JS was as fast…)
Whilst I am talking about browsers, I feel I should moan that Flash 10 for GNU/Linux is still really unstable, I have to restart firefox a couple of times a day because it’s audio gets corrupted or it stops working and just displays a white box in firefox. If only I could restart flash without restarting firefox… Can I do that?
Related articles by Zemanta
Tags: Adobe Flash, JavaScript, Mozilla Firefox 3, Tab

![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_c.png?x-id=3c6b13d5-6170-4311-9dbd-1569799d4bb7)
September 9th, 2008 at 5:04 pm
It’s not just Flash 10 – it’s Flash 9 in FF3 also. I think it’s an FF3 issue.
September 12th, 2008 at 7:27 am
re: Flash10, there are 32bit versions of nspluginwrapper (the wrapper that allows the use of 32bit plug-ins on 64bit installs) around which will do the job nicely. While installed, if flash crashes, you’ll get a gray box instead of having Firefox close up on you. At that point, going to add-ons and disabling/re-enabling flash will bring it back without a restart.
re: Javascript blurb, you’ve got “’s, ”’s and ’’s mixed into that code, which breaks it.
javascript:var w=Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getEnumerator(’navigator:browser’),t=0;while(w.hasMoreElements())t+=w.getNext().document.getElementById(”content”).mTabs.length;alert(”You have “+t+” tabs open”);
September 12th, 2008 at 7:28 am
Ah, neat, it’s just your website that breaks it :p
September 12th, 2008 at 8:59 am
cwillu, thanks for the heads up, the code is now fixed in the website. Re: the disabling/re-enabling of flash through add-ons – I never knew that! Thanks so much! (I assumed you’d have to restart firefox to get the benefit, as with add-ins.)
April 27th, 2009 at 9:29 pm
117 today… Tree-tabs does a good job of hiding them!
July 9th, 2009 at 7:38 am
Wow 3 instances with only 125 tabs try pressing ctrl n and see how many u can get i got to 420 fairly easy and i have a dam sempron processor with 1/1/2 gig or ram runing xp home.
July 9th, 2009 at 9:18 am
Adam, I highly recommend tree-style tabs if you’ve got that many tabs open! I’ve only 60 tabs open today… I’m sure that’ll change when I catch up with Google Reader though!
March 16th, 2010 at 6:13 am
Wow. You geek.
I am surprised that people have that much time to waste.
I am concerned about your well being, and recommend you write code for good, rather than for nothing.
March 16th, 2010 at 10:10 am
Lol, well said.
I wish I had that much time these days…
April 30th, 2010 at 4:39 pm
Very useful. Thank you !!!!
May 6th, 2010 at 6:57 am
thanks for the code, i thought i was going to have to download a plugin to count for me, or…. count.