开发者

Add URL Parameters to the DuckDuckGo searchplugin for Firefox

Here is the xml file for a basic https query to DuckDuckGo:

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Duck Duck Go (SSL)</os:ShortName>
<os:Description>Search Duck Duck Go (SSL)</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,[*redacted image code*]</os:Image>
<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?q={searchTerms}">
</os:Url>
</SearchPlugin>

I want to have certain parameters (namely, kb=-1 and kg=p (link)) append to a search that's performed through Firefox's search box. I've tried adding it using "<Param n开发者_如何学编程ame="paramName1" value="paramValue1"/>" but that doesn't work.

Also, although adding kg=p will make all subsequent requests using POST (rather than GET), how can I make the initial one a POST request. I tried changing method="GET" to "POST", but that doesn't work.


You can use:

<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?paramName1=paramValue1&amp;q={searchTerms}">

Use &amp; for all occurrences of & that would separate parameters, and URL-encode other characters.


I find a way in the latest version of firefox : Windows 10 & Firefox 40.0.3

  • Close all sessions of firefox.
  • Eventually delete C:\Users\"¤¤"\Appdata\Roaming\Mozilla\Firefox\Profiles\"¤¤"\search.json (if you do this you have to restart and close again firefox before continue to recreate a clean search.json)

  • Edit the file search.json

  • Find "https://duckduckgo.com/" (for me at the End Of File)
  • Replace https://duckduckgo.com/ by your own URL parameters like this : https://duckduckgo.com/?kae=d&kak=-1&kf=fw

  • add the char "&" at then end of parameters like this : https://duckduckgo.com/?kae=d&kak=-1&kf=fw&

  • Save file
  • Restart Firefox


I didn't know since when but if you want to do this, the solution consist to edit the file search.json. You will find this one in your profile folder of Firefox.

Inside this file, look for this :

"_urls":
    [{
        "template": "https://duckduckgo.com/?q={searchTerms}",
        "rels": [],
        "params": []
    },
    {
        "template": "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list",
        "rels": [],
        "type": "application/x-suggestions+json",
        "params": []
    }],

Once you have find it, add your parameters by editing the (first one) template like that :

"_urls":
    [{
        "template": "https://duckduckgo.com/?km=m&q={searchTerms}",
        "rels": [],
        "params": []
    },

In this example, I have add km=m. This parameter kmchange the disposal of the result. Instead to be on the left, now there will be centered. Also, don't forget to add & between each parameters your want. Once you have done, save the file search.json and reboot Firefox.

This work fine with the version 29 of Firefox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜