Search code examples
htmlfirefoxurlsearch-engine

Suggest add the search engine to firefox when user is in site


I was at duckduckgo and wanted to add the search engine field to my browser,

Usually you had to search in the browser utility, but I was surprised when I saw the browser already detecting it.

enter image description here

How can I get my site's search to show up automatically like this?

Please note:

I'm not looking (now) to implement the auto-suggest feature, i am just trying to get the service saved in the browser (exact same behaviour with stackoverflow+firefox)

-EDIT-

Tried the code I found on their site, wich matchs with the opensearch documentation:

1)

    <link title="your service name" type="application/opensearchdescription + xml " rel="
search " href="/opensearch.xml ">

2) the xml file: /opensearch.xml

<OpenSearchDescription>
     <ShortName>DuckDuckGo</ShortName>
     <Description>Search DuckDuckGo (SSL)</Description>
     <InputEncoding>UTF-8</InputEncoding>
     <LongName>DuckDuckGo Search (SSL)</LongName>
     <Image width="16" height="16">http://duckduckgo.com/favicon.ico</Image>
     <Url type="text/html" method="get" template="https://duckduckgo.com/?q={searchTerms}"/>
</OpenSearchDescription>

But with my domain name and URL, and firefox is not detecting the service (the same way as in the picture), what am i missing?


Solution

  • I had a look at your site (funcook.com) and:

    1) You have to remove all the spaces in the type attribute of the link tag:

    <link title="Funcook" type="application/opensearchdescription + xml" rel="search" href="http://funcook.com/opensearch.xml" />
    

    becomes:

    <link title="Funcook" type="application/opensearchdescription+xml" rel="search" href="http://funcook.com/opensearch.xml" />
    

    2) You have to use the proper namespace in opensearch.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <OpenSearchDescription>
    [...]
    

    becomes:

    <?xml version="1.0" encoding="UTF-8"?>
    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
    [...]