How to revert the close tab functionality in Firefox 3.5 back to 3.0

In the Firefox 3.5 release the default close tab behaviour has been changed.

The new behaviour is to immediately close the browser when the last tab is closed. This mirrors the way that Internet Explorer handles its tabs and probably makes more sense for the masses.

Personally I had grown fond of the safety net of being able to have zero active tabs. A couple of reasons off the top of my head are that it means you don't accidentally close your browser and have the delay of waiting for it to load up again. You also wont lose your undo close tab / page history cache which is wiped when the browser is closed.

So I set off to find out if there was an extension that would restore this functionality. I didn't find one but I did find some tips that basically let me restore the feature I wanted.

Part one - Don't close the browser with the last tab

The first issue was to get the browser to stop closing as soon as the last tab was closed. This turned out to be pretty simple:

  1. Type about:config into the address bar of Firefox
  2. Agree to the dialog that appears so that you can view and edit the configuration settings
  3. Locate the following configuration item:
    browser.tabs.closeWindowWithLastTab
  4. Set its value from true to false

Part two - Show me the close buttons

This second part is purely cosmetic and optional. The UI was changed so that the final tab didn't have a close button on it any more - to prevent normal users from closing the browser unexpectedly.

The aim is to add a piece of css in to the userchrome.css which is a file tucked away in Firefox for exactly this reason - allowing user modifications to the chrome. The chrome is basically the UI layer of Firefox if you were wondering.

  1. Go to your profile directory, which on Vista is here:
    %appdata%\Mozilla\Firefox\Profiles\
    (Just paste it into the search in your start menu)
  2. Open up your active profile folder. There will probably be only one profile folder in there - it will be called a random string of letters and numbers.
  3. Go into the Chrome folder and open up userchrome.css in notepad (or create it if it doesn't exist).
  4. Enter the following css into it:
/* Add tab-close-button to last tab*/
.tabbrowser-tabs[closebuttons="alltabs"] > 
 .tabbrowser-tab > .tab-close-button {
  display: -moz-box !important;
 }
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) > 
 .tabbrowser-tab[selected="true"] > .tab-close-button {
  display: -moz-box !important;
 }

Sources

The tricks in this article were found in the following forum thread:

Further Reading

If you're a Firefox user then please consider checking out my Firefox extension called "Good Deeds".

Its a simple extension which loads up a website called TheRainforestSite.com once a day so that you can click the button on that page. Every time you click that button the advertising money which is earned on the following page is contributed towards saving the rainforest.

1 comment :

Ganesh said...

Thanks for the workaround on the close tab functionality! It got to me within a day of updating to the latest version