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.
![]()
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