2016-07-11

Customizing Firefox Search Engines

Being very annoyed by not having a POST search engine by default, I dug a bit into FF's search engine configurations. Some online articles/posts were somehow not working for FF 47, noting how I got this done here, for future reference.

Ref 1 2 3

Why

You can surely easily add search engines in FF addons markets, but unfortunately the POST version of my favorite search engine is somehow not working for me. If you are unlike me and happy with what you have, don't bother continuing.

How

  1. First, quit FF.
  2. Then check in the FF profile folder, there should be one or more files named starting with search. In my case, there were search.json.mozlz4, search.json, search-meta.json.
  3. Delete all of them, so that FF could recheck all available search plugins in searchplugins folder.
  4. Create searchplugins if you don't have one.
  5. Create an XML file with a sensible name, and create the search engine specs in this file with OpenSearch format.
  6. If an existing plugin is available for reference that's great. Otherwise, try using a tool to build from scratch, e.g. with mycroft project tool.
  7. Make sure the XML file is valid. Start up FF.
  8. Go to about:preferences#search, and the new search plugin should be visible in the list.


Update 20190131


Updated prior ref pointed to this comment, which does not require touching anything in FF folder. What worked for me was:
  1. Go to about:config
  2. Open JS console
  3. Run Services.search.addEngine("file:///path/to/your/opensearch.xml", null, null, false);
Startpage's OpenSearch XML could serve as a template, and a prior ref could serve as a reference for how to add POST parameters. XML that I used was:

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Startpage</os:ShortName>
<os:Description>Startpage Search</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16" type="image/x-icon">https://www.startpage.com/assets/images/logo-16x16.png</os:Image>
<os:Url type="text/html" method="POST" template="https://www.startpage.com/do/dsearch">
  <Param name="query" value="{searchTerms}"/>
  <Param name="prfe" value="36c84513558a2d34bf0d89ea505333adb92ef6e4f6ab17dad119096d3b428afa984abfd0db70840b"/>
</os:Url>
<SearchForm>http://startpage.com/</SearchForm>
</SearchPlugin>

No comments: