Search engines such as Google and Bing are relatively well performers in the quest for specific bits of information. With some practice you should be able to find the information you seek within the first page of results. Sometimes, however, it is more beneficial to search just a specific web site as the results are more finely tuned to the cause. For example, searching a support section of a website for a particular piece of software. Many web sites include their own search back end, even if it’s less than ideal. Alternatively, sites like Google provide mechanisms to constrain the search results to a specific site – logically using the site: prefix.

Both Firefox and Chrome support searching your default search engine directly from the address bar; though it does surprise me to see people still visit google.com or bing.com first in order to search. Old habits die hard I suppose? Expanding upon this feature, it’s actually pretty straightforward to enable the browsers to search the specific site you are viewing and yet still leverage your default search engine; just like the site: modifier above.

The magic is contained within a single line of javascript:

javascript:location.href=’http://www.google.com/search?q=site:’+window.location.hostname+’%20%s’;

To incorporate this feature into Firefox first create a new bookmark – it actually can be of web site as we are going to change it’s property details. After a bookmark is created, right-click on it and select Properties.

Inside the Properties dialog, assign the bookmark an appropriate name and for the location, supply the javascript snippet above in completeness. Lastly, the keyword is the text to pre-pend to the desired site specific search string when in your address bar. I chose ss for site search – but really it can be anything you wish. Then Save your changes.

Returning to the Firefox address bar while already browsing the support.microsoft.com website we can activate our site specific search.

Executing the search will actually perform a Google search on internet explorer printer limited to just support.microsoft.com.

Implementing the same functionality with Google Chrome is equally possible. Right-click in the address bar and chose Edit search engines. Provide a similar name, keyword, and location (the javascript snippet) just as you did for Firefox, but this time within the Chrome interface.

The behavior using the keyword ss is the same as it was in Firefox, but this time from within the Chrome browser.