Saturday, May 5, 2012

Google Search - Context Menu Addin For Internet Explorer

Create a html filed named say “GoogleSearch.htm” in a location say “D:\Lotus Notes\tools\MyIEPlugins”
Now code the html file with the following code and save it
<script language="JavaScript">
  var parentwin = external.menuArguments;
  var doc = parentwin.document;
  var sel = doc.selection;
  var rng = sel.createRange();
  var str = new String(rng.text);

  if(0 < str.length)
      + str, "_blank");
Now open your registry editor and traverse to the following key “HKCU\software\microsoft\Internet Explorer\MenuExt”
Now create a key named “&Google Search”
Now on the right side change the (Default) attribute’s value to the location of your html file that we created in the beginning
Now create a new DWord named “Contexts” and specify its value as 0x10.
Now start or restart your internet explorer.
Open a web page or your choice. Select some text and right click on it. Voila you will find some thing like the following

This will bring up a new window with the google search for the selected text as illustrated by the following screen shot

Likewise you can do it for Live Search as well. All you got to do is tweak your url a bit
""      + str
Hope this helps J

No comments:

Post a Comment