Saturday, June 2, 2007

Make Googling Faster in Firefox

Firefox 2 has a little Search Box built into the browser into which one can type in ones search queries without going to the search engine website. Usually, the default behaviour for the Search Box is to send its query to google.com. When a person does so from a PC in India, the google.com servers automatically redirect the search request to a google.co.in server for localized results.

Now that’s where our problem is. This redirection causes a noticeable and irritating lag which is entirely useless (and unacceptable!). I would be quite fine with results from google.com instead. So is there a way to make the Search Box send its query directly to the google.co.in servers ? Turns out there is !

The Search Box is not very configurable from within the browser itself. The only thing one can do is to add or remove more search engines or change the default serach engine.

However, if you take a moment to navigate to the Firefox 2 installation directory (probably C:\Program Files\Mozilla Firefox\) you’ll see a directory “searchplugins” in there with a file corresponding to each of the installed search engines.

In Firefox 2, the files are .XML files. Google.xml is what seems to be interesting for us at the moment. Open it ! But if you open it with Notepad, the line breaks will not show up properly. So use either Wordpad or Editplus or something similar if you are on Windows.

In case you are using an older version of Firefox, you’ll see an image file which contains the icon for the Search Engine and a .SRC file. Open Google.src in this case.

I’ll proceed assuming that you have the ‘latest and greatest’ version of Firefox, Firefox 2. But the same idea is easily applied to older versions.

Now there are many things in Goolge.xml, but just look at the line with the URL tag,



Aha ! Change “google.com” in that line to “google.co.in” ! Save the file. And it’s done !

Restart Firefox. Type in a query into the Search Box and feel elated at the reduced latency of your searches. No more redirection is involved from the google.com servers. Yay !

Now for some bonus info. We saw that older versions of Firefox had an image file for the icon and a .SRC file for configuration info. But in the newer version, there is a single .XML file. So where did the icon go ?

The icon is now embedded in the .XML file. But mixing binary image information with textual configuration information can be problematic. So how does one store the icon along with the rest of the configuration data ?

Base64 Encoding can be used for doing that. This kind of encoding is often used to convert binary information into a form that can be stored and transferred in a manner that is compatible with normal text. If you see the contents of the .XML file, you’ll see an tag which contains the Base64 encoded icon.

Ok. So this does seems a little too easy to be labelled a “hack” at all. But nice enough for majority of the people out there. Maybe I’ll put in something more l33t for all you h4X0rs out there…but that’s for another day.

Until then, enjoy the faster search results !


View Source

1 comment:

Onkar Joshi said...

Nice to have a link back to the source (my blog).

But it would have been nicer to have only a summary over here instead of the entire article.

Thanks anyway. Will keep checking back at your blog.

Cheers,
Onkar
http://onkarjoshi.wordpress.com/