Wednesday, November 12, 2008

HOWTO add search engine to firefox

Problem : I just wanted to add a search engine to FF 3 which is not supported by FF search engine add-ons.

Sol: Because the search engine itself did not support FF search engine add-on either, I had to add it by hand.

Someone suggested editing the about:config page, but it will change the default search engine, it didn't help.

After googling, I found that searchplugins directory exists under your directory( e.g. Mozilla FirefoxC:\Program Files\Mozilla Firefox\searchplugins ). There were several xml files. So I opened some of them with text editor. Not knowing what to do exactly, I copied one of them and renamed as I wished. For example "yahoo-kr.xml" It looked like ....

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Yahoo</ShortName>
<Description>Yahoo Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,R0l...</Image>
<Url type="application/x-suggestions+json" method="GET"
template="http://kr.ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" />
<Url type="text/html" method="GET" template="http://kr.search.yahoo.com/search">
<Param name="p" value="{searchTerms}"/>
<Param name="ei" value="UTF-8"/>
<MozParam name="fr" condition="pref" pref="yahoo-fr-cjkt" />
</Url>
<SearchForm>http://kr.search.yahoo.com/</SearchForm>
</SearchPlugin>



So, I guessed that ShortName would be its name, description the description. Image will be the icon or favicon, and the first Url tag will be the url for autocompletion. The last url tag will be the search engine url.

Rename the ShortName and description as I wished, I could have give up the auto completion, but I just used the old one.

The second URL tag and SearchForm tag are changed as I wanted. then, it just worked.

I was satisfied for a few seconds, then I found that two different search engine had the same favicon and that was so confusing.

So I googled again, and found this page and that page had this link. So I could obtain the character string from an image. By putting this string in the Image Tag. I finally could pleased.

No comments: