Ever Wondered How Many Firefox Tabs You Have Open?

Mozilla Firefox IconImage via Wikipedia

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?

Reblog this post [with Zemanta]

Tags: , , ,

Bookmark and Share

11 Responses to “Ever Wondered How Many Firefox Tabs You Have Open?”

  1. JofArnold Says:

    It’s not just Flash 10 – it’s Flash 9 in FF3 also. I think it’s an FF3 issue.

  2. cwillu Says:

    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”);

  3. cwillu Says:

    Ah, neat, it’s just your website that breaks it :p

  4. Benjie Says:

    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.)

  5. Benjie Says:

    117 today… Tree-tabs does a good job of hiding them!

  6. Adam Says:

    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.

  7. Benjie Says:

    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!

  8. Gish Says:

    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.

  9. Benjie Says:

    Lol, well said. :P I wish I had that much time these days…

  10. Crisanto Says:

    Very useful. Thank you !!!!

  11. thealphabests Says:

    thanks for the code, i thought i was going to have to download a plugin to count for me, or…. count.

Leave a Reply