Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple site search with Duckduckgo

I would like to add simple site search, using Duckduckgo, limited to search only "example.com".

Stackoverflow has solved this, using some JavaScript to add the site:example.com filter to the query.

<form onsubmit="var txt=$(this).find('input[name=\'q\']'); txt.val(txt.val() + ' site:stackoverflow.com');" action="http://www.duckduckgo.com/" method="get" id="duck-duck-go-search">
  <input type="text" value="" maxlength="255" size="36" name="q">&nbsp;
  <input type="submit" value="DuckDuckGo">
 </form>

I'd prefer a solution that does not depend on JavaScript, though.

The URL should be http://duckduckgo.com/?q=site:example.com%20might; the site:example.com must be added to the q= parameter, it seems.

Has anyone found a simple, non JavaScript solution for this?

like image 274
berkes Avatar asked Aug 31 '11 15:08

berkes


People also ask

What is the downside to DuckDuckGo?

Cons. DuckDuckGo doesn't offer as many services as Google and other search engines. It doesn't have the same market share as Google, so you cannot sync lots of your accounts and services with it.

Can you search anything on DuckDuckGo?

Each time you search on DuckDuckGo, you have a blank search history, as if you've never been there before. We simply don't store anything that can tie searches to you personally.


1 Answers

I contacted DuckduckGo and got a solution from Weinberg himself.

There actually is a hidden sites param :). Try it! Gabriel, http://ye.gg

It was the plural (not site, but sites) that got me confused, but the solution is very simple:

http://duckduckgo.com/?q=duckduckgo& sites= stackoverflow.com

Or, in a simple HTML form:

<form action="https://duckduckgo.com/" method="get">
  <input type="hidden" name="sites" value="stackoverflow.com">
  <input type="search" name="q">
  <input type="submit" value="Search">
</form>
like image 196
berkes Avatar answered Jan 06 '23 09:01

berkes