Customizing Firefox’s search bar to ban useless web sites from Google

March 10, 2010
Tags: ,

I love Firefox’s tabbed browsing and search bar for collecting research and solving problems. It’s so fast: press CTRL+T to open a new tab, press CTRL+K to switch focus to the search bar, type the search keywords, and press ENTER.

What I don’t like is when I eagerly click a promising search result and am greeted by something similar to the following:

experts-exchange.com preview page

experts-exchange.com preview page

experts-exchange.com has caused me quite a bit of browsing letdown over the past couple years of technical research. They may have the most relevant result to all my queries as promised, but I am not going to sign up for the experts-exchange.com service to find out. I can remove these annoying search results by adding the following operator to my Google search queries: -site:experts-exchange.com. In fact, any web site can be excluded from Google’s search results by adding this operator in the form -site:badwebsite.com.

The -site operator is effective, but it is impractical to add this operator to every Google search we perform. Luckily, we can customize Firefox’s search bar plugin to automate this procedure and banish experts-exchange.com from all Google searches through eternity. Here’s the procedure.

Create a copy of %systemdrive%\Program Files\Mozilla Firefox\searchplugins\google.xml in the same folder and save it under a different name (e.g. google_ban_experts_exchange.xml). Open the new .xml file with your favorite text editor.

Modify the content of the ShortName element. This value determines how Firefox will name the new search plugin:

<ShortName>Google (no EE)</ShortName>

Secondly, find the following line:

<Param name="q" value="{searchTerms}"/>

The value attribute specifies what is sent to the search engine URL when the search plugin is used. {searchTerms} is a variable that expands to the text entered in the Firefox search bar. Modify this line as follows:

<Param name="q" value="{searchTerms}+-site%3Aexperts-exchange.com"/>

Note that, for Google, a space character between keywords or operators must be changed to a plus sign (+) when used inside the Param element. Also, the colon character must be percent-encoded, so it is changed to %3A.

Save the changes to the .xml file and restart Firefox, if necessary. Click the dropdown button to the left of the Firefox search bar; Google (no EE) is now available from the list. After performing a search using this new plugin, the results screen should show Firefox automatically adds -site:experts-exchange.com before performing the search.

I picked on experts-exchange.com in this post (and rightly so, since they've dashed my hopes for at-my-fingertips content so many times), but this trick can be used to customize searches using other operators as well. For example, one could build a search plugin that constrains results to a range of dates or that searches only for files of a certain type.

DiggDeliciousFacebookTwitterStumbleUponGoogle ReaderShare

Leave a Reply