About a year ago, I posted my technique for configuring the search bar in Firefox 1.5, complaining that it was far too small in the default UI layout that comes with the web browser. In fact, this bug still exists today and has 280 votes. But then again, your vote doesn't matter. Anyway, Firefox 2 alleviated the hacking that I had to do to get the search bar to expand to fill up remaining space. There's just one tweak in Firefox 2 that I still need for perfect search bar nirvana.

This is what I do with the search bar: As described here, I move the search bar to the menu bar (yep, immediately to the right of the "Help" menu in Windows). This means that both the Location bar (where you type your web addresses) and the Search bar (where you type your Google/Yahoo/MSN searches) have room to breath by expanding to fill in any space in that toolbar strip. It's a simple matter of going to View > Toolbars > Customize and then dragging the search bar where you want it.

That being said, I still have one problem with it. Occasionally, I'll want to recall a recent search. Unlike the Location Bar, the Search Bar does not have a visible pull-down arrow that shows you how to see previous search history. You can use the arrow keys to access this pull-down list, but that is not obvious to new users - and generally speaking, the reason I want to pick an old search from my history is because I'm too lazy to re-type it in the first place, so Firefox - don't force me to access the keyboard!

Anyway, it's easily fixable by hacking a little chrome. Here are the revised steps that apply for Firefox 2:

Unroll The Browser Chrome

  • Open a terminal session (Windows users can go to Start > Programs > Accessories > Command Prompt).
  • Navigate to the location of your Firefox install (for example, C:\Program Files\Mozilla Firefox\)
  • Change to the "chrome" subdirectory
  • In the chrome subdirectory, type the following: jar xvf browser.jar
    This will unroll the browser chrome JAR file into a "content" subdirectory.

For those of you that don't have a Java Runtime Environment (JRE) installed, you can use WinZip or a similar tool to find the browser.jar file and extract it.

Modify The Chrome

  • Edit the file content/browser/search/search.xml
  • Find the xul:textbox with class="searchbar-textbox" and add the following attribute to it: enablehistory="true"
  • While you're at it, modify the maxrows attribute to something more useful than 10 (like 20, for instance).

Roll Up The Chrome

  • Navigate back to the chrome subdirectory
  • Re-zip up the chrome files by typing: jar cvf browser-new.jar content/*
    This will create a new file called browser-new.jar
  • Close all instances of Firefox
  • Swap the browser JAR files. For Windows users type:
    rename browser.jar browser-old.jar
    rename browser-new.jar browser.jar

That last step will ensure that you backup your old chrome file (now called browser-old.jar). This is always recommended, because if you screw something up you can always restore it.

For those without a JRE installed, you'll have to use Winzip or a similar utility to recreate the JAR file. In WinZip, you can right-click the content" folder, choose WinZip > Add to content.zip. Then rename content.zip to browser.jar (once you've backed up your older browser.jar file).


Now test things out by bringing up Firefox. You should see a little pull-down arrow in your search bar that works as expected. If you've done something wrong, then you can undo by simply closing Firefox and restoring your old chrome file.

In fact, I've submitted this as an alternative one-line patch to Bug 264199. Let's see what the module owners say.

§351 · March 30, 2007 · Firefox, Software, Technology, Tips, Web · · [Print]

5 Comments to “A Little Tweak To Firefox 2 Search Bar”

  1. Brent says:

    Where do I put the enablehistory=”true” line in the search.xml file? I tried putting it like 5 different places in the xul:textbox part of the file, but when I opened firefox the search bar had just totally disappeared.

  2. Brent says:

    Never mind about where to put it, I saw in the Bug page, but I am still getting a firefox without a search bar. Maybe it is something to do with how I zip/unzip the jar file…

  3. Brent says:

    OK, no, it is not that, because when I deleted the two lines (so the search.xml was back to its original form) everything was fine. Any ideas?

  4. Jeff says:


    The following is an excerpt from content/browser/search/search.xml:

    <xul:textbox class="searchbar-textbox"

  5. Tom says:

    I noticed that slow responding search engines lead to Firefox not showing any suggestions.

    I have tried to tweak the timeout=”250″ parameter by setting it to “1000” or even to “2000”, but this did not solve the problem. Has anyone a solution for my problem ?