Make Bing Desktop search Google

July 5, 2012

Microsoft recently released Bing Desktop. If you like their idea of having web search handy all the time, but prefer to search with Google, read on.

Bing Desktop screenshot

I made a small extension for Chrome – all it does it redirecting search queries from Bing Desktop to Google. This only works if Chrome is your default browser!

You can install my Bing Desktop to Google extension from here or install from the Chrome Web Store.

Please note that this requires that Chrome is already running, when you search using Bing Desktop. This is my first Chrome extension and unfortunately I don’t know how to fix this.

Technical details

This extension consists of two files, manifest.json and background.js. The manifest tells Google which permissions the extension requires and what other files it includes:

{ // ...
    "permissions": [
        "webRequest",
        "webRequestBlocking",
        "*://www.bing.com/"
    ],
    "background": {
        "scripts": ["background.js"]
    }
}

The webRequest permissions means this extension can intercept web requests (i.e. when the user enters a URL). The webRequestBlocking permission means that the extension can stop web requests from continuing, until it is done modifying them. This is required so we can redirect to Google before any traffic is sent to Bing. Finally, the “*://www.bing.com/” part tells Chrome to only run this extension when visiting some page on Bing.

background.js is what Google calls a “background page”, even though it’s only a simple JavaScript file. Its contents are:

chrome.webRequest.onBeforeRequest.addListener(function(details) {
    return { redirectUrl: details.url.replace("www.bing.com/search", "www.google.com/search")};
}, {urls: ["*://www.bing.com/search*"]}, ["blocking"]);

Here, we add an event listener to the “onBeforeRequest” event for web requests. Due to the second parameter urls the function is only called when the URL matches a Bing search query (so you can still go to Bing and look at their pretty wallpaper, for example). Finally, if the URL matches, the request is redirected to Google, by rewriting the domain. Fortunately both Google and Bing use the same parameter q for the search term, so it wasn’t necessary to rewrite anything else.

  • Pingback: Google to discontinue Mini search appliance, iGoogle, other products

  • Clark Kent

    lol, excatly what i was looking for :)

    Thank man !

    • Claus

      You´re welcome glad you could use it :)

  • Grindsome Atworths

    hehehe awesome thanks +1 ;)

  • Sunhowie

    didn’t work

    • Claus

      Newer Chrome versions only allow installing extensions from the Chrome Web Store, so I uploaded it there – see the new link in this post.

    • John

      In addition to Claus’s comment, I had to exit Bing Desktop and restart it. I’m running Windows 8 though and was messing/confirming my default browser settings though, so that may have had something to do with it. Working like a charm now though.

  • https://plus.google.com/101590783768757183765/about Abhishek Shetty

    Thanks for making it :D

  • Khalid Hassan

    Thanks man, Its a great Hack.
    I could not install it directly so this is how I managed to install it.
    1- Extract the extension to a folder.
    2- Switch to Developer Mode in the Google Chrome’s extensions page.
    3- Click “Load unpacked extension”
    4- Select the folder where you extracted the extension.

Previous post:

Next post: