30

I need to add a custom search engine to Firefox. I have a name and a search URL. How do I add those to the available search providers?

Michael
  • 8,362
  • 6
  • 61
  • 88
Nusrat Nuriyev
  • 1,134
  • 2
  • 13
  • 29
  • 2
    See related question at SuperUser which is not closed: https://superuser.com/questions/7327/how-to-add-a-custom-search-engine-to-firefox – wisbucky Sep 24 '19 at 20:51

8 Answers8

26

If you are just trying to search a certain site from the address bar, you do not have to create any OpenSearch XML.

You can add a bookmark with %s as a placeholder, and give it a keyword. The subsequent search terms will fill into the placeholder. For an example that searches Stack Overflow, put these fields into a "New Bookmark:"

Field Value
Name Search Stack Overflow
Location https://stackoverflow.com/search?q=%s
Tags development (your relevant tags)
Keyword so
Description

To perform a search, type so How to exit Vim into the address bar and hit return.

If you have also added search engines in Chrome, you will recognize the same %s placeholder that is used in chrome://settings/searchEngines. I do not know, but it may be that Chrome also uses bookmarks like Firefox under the hood.

Michael
  • 8,362
  • 6
  • 61
  • 88
  • This works great (no restarting required) and *could* (should...) be cross-browser! – RJVB Nov 05 '18 at 10:21
22

Here are the steps:

  1. Create an OpenSearch XML file containing information about your search engine like ShortName, Description, URL, etc.

  2. Give a name to that XML file and put it in one of these folders:

    • Available just to you

      %APPDATA%\Mozilla\Firefox\Profiles\XXXXXXXX.default\searchplugins
      
    • Available to anyone on the computer

      %PROGRAM_FILES%\Mozilla Firefox\searchplugins
      
  3. Modify Firefox's preferences file at %APPDATA%\Mozilla\Firefox\Profiles\XXXXXXXX.default\prefs.js. Simply add/modify this line:

    user_pref("browser.search.selectedEngine", "engine_name");
    

There is no need to modify a sqlite database file manually. The new search engine will be added automatically after restarting Firefox.

Michael
  • 8,362
  • 6
  • 61
  • 88
Nusrat Nuriyev
  • 1,134
  • 2
  • 13
  • 29
  • 3
    My experience was that step 3) was not necessary, but what *was* necessary to have the new xml file recognized was to delete search.json and search.sqlite in %APPDATA%\Mozilla\Firefox\Profiles\XXXXXXXX.default – Nathan Stretch Aug 12 '13 at 05:27
  • 1
    Firefox 30.0 (Ubuntu) -- I didn't have to do step 3 either. I also didn't need to delete search.json and I saw no search.sqlite. – Lambart Jul 11 '14 at 18:20
  • somehow this works great on my work computer but not on my personal PC :( – phuclv Apr 10 '16 at 13:48
  • 2
    This only works up to FF 45. Here's an [alternative way to do it](https://bugzilla.mozilla.org/show_bug.cgi?id=1236498#c7) (which works even if the searchplugins folder does not exist); however, it does **not** work for FF Quantum. – jpaugh Jan 30 '18 at 16:23
  • 1
    @jpaugh Here is a solution that works with Firefox 78 (on Linux at least): https://superuser.com/questions/7327/how-to-add-a-custom-search-engine-to-firefox/1566328#1566328 – baptx Jul 05 '20 at 20:53
19

You can also use this opensearch Mycroft Project

It has everything already created just enter the values into textbox and and you have the XML code; and you can install the search engine directly in the browser from there.

You can also submit your website search engine, and search for (and use) a search engine submitted by another user.

jpaugh
  • 6,634
  • 4
  • 38
  • 90
sumitkanoje
  • 1,217
  • 14
  • 22
  • 4
    When trying to add a plugin from that site to Firefox, I get a popup saying "Your browser does not support OpenSearch search plugins", which is clearly not true (and the site itself says Firefox does). Even if it worked, I have to say: that is one awful web site. – Lambart Jul 11 '14 at 18:17
  • This still works with FF Quantum! You can search existing entries (submitted by other users) [here](http://mycroftproject.com/search-engines.html). – jpaugh Jan 30 '18 at 16:45
  • 1
    This is amazing. They claim to have 23k websites. Best part: it worked in just a few clicks. – Peeyush Kushwaha Dec 24 '18 at 14:29
  • How do I "install the search engine directly in the browser?" – gargoylebident Dec 29 '21 at 17:13
8

The easiest way to add new search engines is via the "Add to Search Bar" add-on, simply right click on the search form on the webpage you want to add, then "Add to Search Bar" and it will show up in the Search Bar:

Grumbel
  • 6,585
  • 6
  • 39
  • 50
3

Make sure that your & is escaped as &
Firefox will NOT activate the search engine that are broken in format
Check https://developer.mozilla.org/en-US/Add-ons/Creating_OpenSearch_plugins_for_Firefox#Troubleshooting_Tips

Just put a right xml file in right place,it will take effect after restarting firefox

3

I came here to add tldr-pages as a custom search, looking for a way how to do that.

Turns out, that there was a very simple way: In Firefox, next to the URL-bar, there is a search-bar with a magnifying-glass. If that magnifying-glass has a PLUS on it, the page you are looking at offers its own openSearch.xml-file.

  • hit the search-box
  • a pop-up opens
  • find the line that says "Add" at the bottom and
  • click it

That is how I solved my initial problem and maybe it solves yours, too.

Chris
  • 5,788
  • 4
  • 29
  • 40
  • 1
    FWIW, OpenSearch works by providing an XML file in [this format](https://developer.mozilla.org/en-US/docs/Web/OpenSearch), and linking it with `rel="search"`. For example, on tldr-pages, we see: ``, which adds [this file](https://tldr.ostera.io/opensearch.xml). – jpaugh Jan 30 '18 at 16:05
  • BTW, I got this to work in Ubuntu (Linux), but not Windows. Not sure what's going on, but it might be one of those custom modifications that Canonical makes to Firefox for Ubuntu. – jpaugh Jan 30 '18 at 16:12
  • @jpaugh this should be added as an official answer. – Finch_Powers Feb 08 '18 at 19:48
  • @Finch_Powers Thanks! Though, I didn't really answer the OP's question, but simply explained Chris' answer in more depth. – jpaugh Feb 08 '18 at 20:17
  • Nice way to get the official search formula added automagically, but it would be even nicer if the add option could be accessed without showing the dedicated search widget (which takes up unnecessary place). But maybe it's possible and I overlooked it? – RJVB Nov 05 '18 at 10:24
0

Give this a try.

http://www.investintech.com/resources/blog/archives/5263-address-bar-search-engine.html

Using Iceweasel (Linux), should work for Firefox too. Tried it for about 30 sites that i had with Chrome/Chromium.

Pro:

Works!

Cons:

Too much manual work.
Moni
  • 73
  • 2
  • 8
0

This helped for me on Firefox v50:

  1. Close Firefox.

  2. Delete in profile of Firefox: search.json, search.json.mozlz4

  3. Copy your OpenSearch from the searchplugins folder.

  4. Add an entry in search-metadata.json:

    "[profile]/your-opensearch.xml": {
      "alias": "your-opensearch",
      "order": 25
    }
    
Michael
  • 8,362
  • 6
  • 61
  • 88
Mr.Angel
  • 117
  • 1
  • 4
  • This did not work for me with Firefox 78 but I found another solution: https://superuser.com/questions/7327/how-to-add-a-custom-search-engine-to-firefox/1566328#1566328 – baptx Jul 05 '20 at 20:51