Archive for April, 2009

Custom Google Site Search for Firefox Searchbar

This is a short tutorial on how to add a custom Google site search to the Firefox search bar. For illustration purposes, the example I will use is a Google search of ubuntuforums.org (which is, in my opinion, one of the best resources for Ubuntu and Linux support). I am using Firefox 3.0 on Ubuntu, but the steps should be the same for any Linux distribution. The process is basically the same for other operating systems, but some variables may be slightly different (such as the location of the Mozilla configuration folder).

Firefox search bar with Google site search for ubuntuforums.org

Firefox search bar with Google site search for ubuntuforums.org

This is really a simple process which simply involves creating an xml configuration file and placing it in the correct directory. So, to start off, just fire up your favorite text editor to get started.

The first line tells Firefox that we have a search plug in and where to find the specifications for the xml mark-up.

<SearchPlugin xmlns=”http://www.mozilla.org/2006/browser/search/” xmlns:os=”http://a9.com/-/spec/opensearch/1.1/”>

Next, we want to give it a name. This is the name that will show in the search box when nothing entered.

<os:ShortName>Ubuntu Forums</os:ShortName>

Now we need to tell it what encoding to use for the input.

<os:InputEncoding>UTF-8</os:InputEncoding>

The next step is to enter our search engine information. Where you see sitesearch=ubuntuforums.org, this can be replaced with any site you would like to search.

<os:Url type=”text/html” method=”GET” template=”http://www.google.com/search?q={searchTerms}&amp;sitesearch=ubuntuforums.org”>
</os:Url>

Now just add the final line to close out the search plug in code block.

</SearchPlugin>

The only thing left to do now is save the file in your ~/.mozilla/firefox/profile/searchplugins folder. I saved mine as ~/.mozilla/firefox/0k978qn5.default/searchplugins/ufsearch.xml

Now you should be able to search your favorite site with Google from the Firefox search bar. Enjoy!

Search plug-in in action

Search plug-in in action

Note: You may have noticed that I have an Ubuntu icon next to the search box. While creating the icons are beyond the scope of this tutorial (and my knowledge), feel free to add the information (or a link) in the comments section. The code for the Ubuntu icon is :

<os:Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/
AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gUYBy8UWHdfBwAAAcJJREFUOMuVk09IVFEUxn/
nNb7pkbV7r4jQQHKTbQya2rSxJJmoRbYLEqZl0MJolataFkW4k0ebmDaVCD4EEQdsEW+aTRuxdKGDCDMuhJjxNWN5WnjHzHkqntW958/
lu993PjhEhHjDId5iiHerkZO9mjXjtADdwGVgY+lLcqo0a3835ekU5R6ARNNg7uxRqmsOo/UscKORb79Se1SatceBa0A2FoEqwoQ7jeocn6ojwFfAMuUa8
LRWkYVkqy6LHxWaHwjcAeAt8AfdvMDoegewCnjAfeCOaS0C58WPKvIPutvKOvPAKYQVNqRbbpdLu3gZAR6Y65D40XNLM067ZpxBwnonEJm/PN49bOIZUDfn
3gaJH4GLzNe/0dXyBpFXbOpMnDLiR0XNOPeADuBXrAoHRd4/vuMWkTDE9HPOziHyAQBLrgLvYxapDXgH2MBn4LUlfrQkfvSSlP0DcLawygsd807GABgyww
CTB8qYv3lkXxlTlCt7LlI+bcUuUuKELvz+KcspyoUmEkVQzR3ro7rmQDK7YxjgyaVAr29JqQ9JU9jXTCHef2Y6M6BTp++ybSZJr/YcVkE0cIc1cBc1cLft/
BckXKkAO9v5fAAAAABJRU5ErkJggg==</os:Image>

, , , ,

5 Comments