MSDN site search bookmarklet - alternative to F1

This isn't C# related but I've shoved it here anyway. If you use Visual Studio 2008/2005 for your C# you probably get annoyed by the length of time F1 takes, or the fact it hangs the whole IDE if you're waiting for an update.

The solution (for the .NET framework apis only) is to create a new bookmark and paste the code below in. You then get an instant Google-powered MSDN search.

javascript:q%20=%20""%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt("MSDN%20search%20...%20",%20"");%20if%20(q!=null)%20location="http://www.google.com/search?q=site:msdn.microsoft.com%20"%20+%20escape(q).replace(/%20/g,%20"+")%20+%20"";%20void%200

You can even modify it slightly to use feeling lucky, if you know exactly what you're looking for:

javascript:q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("You didn't select any text.  Enter a search phrase:", ""); if (q!=null) location="http://www.google.com/search?btnI=&q=site:msdn.microsoft.com%20" + escape(q).replace(/ /g, "+");%20void%200

I've only tried this in Chrome but they should work universally.

Last updated on 08 August 2009

Comments

blog comments powered by Disqus