Recently I’ve become something of a fan of Duck Duck Go, the anonymous search engine that doesn’t log all your searches. As big a fan as I am of Google’s products, they don’t need to know everything! I like DuckDuckGo not just because of the anonymity though – it also comes up with some really great answers. And as well as being it’s own thing, it also lets you link through to other search engines using “!bang” operators.

A few examples:

!g takes you to Google search
!b takes you to Google search
!gi takes you to Google Images
!xls filters the result to .xls files
!sx searches Stack Exchange
!python searches the Python docs

There’s a full list of the options on their site.

It’s actually seems a cleaner way of doing things than Google’s filetype:xls, site:stackexchange.com, etc. Though I can also see the potential for overlap between !bang operators.

Sadly, I didn’t know about the !bang categories earlier today when certain things were starting to bug me about having DuckDuckGo as my default search in Chrome. To solve the occasional problem without giving up the benefits of having DuckDuckGo as my default I decided to put together this quick javascript bookmarklet to take the query from the URL and pass it on to Google.

javascript:
var url=window.location.href;
if(window.location.hostname=="duckduckgo.com"){
var query=url.split("=")[1];
var google_link = "https://www.google.com/#q="+query;
this.location.href = google_link;
}

So should you decide that typing is too much like hard work, you can add the bookmarklet to your browser by dragging this link –DDG to Google– to your bookmarks bar. To use it, whenever you see that DuckDuckGo doesn’t have the answer you want, just click the bookmarklet and you’ll be spirited away to the land of Google.

Jamie Bull | jamiebull1@gmail.com

Related Posts

WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]

Just a quick post to point out a couple of really useful tools.The first is a web-based tool for finding weather files for a location of interest. It’s similar to the Excel EPW finder tool we created a few years back, but much more modern looking. It is however missing a few of the useful […]

Eppy is a really useful library which I’ve written about several times, since before I really had anything to offer in terms of contributing code. Over the past year or so though, I’ve started to contribute back some of the changes and additions I’ve made while using eppy on academic and commercial projects.This post is […]

1 Comment on “DuckDuckGo, !bang, and javascript bookmarklets”

  • Rob Inhude says:

    Found elsewhere. Even easier. You can make a slew of alternative search bookmarklets with it:


    javascript:Q=[]; c=location.search.slice(1).split('&'); for (i in c) { f=c[i].split('='); if (f[0]=='q' || f[0]=='as_q' || f[0]=='p' || f[0]=='query') if (f[1]) Q.push(f[1]) } R=unescape(Q.join('; ').replace(/\+/g,' ')); location = 'http://www.google.com/search?q=' + escape(R);

Leave a Reply

Your email address will not be published. Required fields are marked *