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

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

Leave a Reply