I spend a lot of time on Google and often jump to it from other sites to search for something I just read about. Wouldn't it be nice if I could just highlight text on a webpage, right-click and click "Search Google" from the context menu? Well now you can! About a year ago, I came across a Windows Tips and Tricks page and it explains a very easy way to do this.
Download codeTo add "Google Search" to your Internet Explorer context menu (like Firefox has), here's how.
According to Microsoft, this method of adding context items should work as early as IE4.
Download the above code instead of creating the files from scratch (much easier).
Open notepad and paste the following code:
1Windows Registry Editor Version 5.00
23[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google As Is]
4@=
"C:\\google_context_noquote.js"5"Contexts"=hex:10
67[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google w/Quotes]
8@=
"C:\\google_context_quote.js"9"Contexts"=hex:10
You can change the paths to the js files if you want, just make sure you put the files where this says they are.
Save the file as google.reg, right-click it and select merge (or just double-click it).
Your registry was just updated to show two new entries in your IE context menu...now we need to create the js files.
Open notepad, paste the following code and save it as "google_context_noquote.js":
1<script language="javascript">
2// Get the window object where the context menu was opened.
3var oWindow = window.external.menuArguments;
4
5// Get the document object exposed through oWindow.
6var oDocument = oWindow.document;
7
8// Get the selection from oDocument.
9var oSelect = oDocument.selection;
10
11// Create a TextRange from oSelect.
12var oSelectRange = oSelect.createRange();
13
14// Get the text of the selection.
15var sNewText = oSelectRange.text;
16
17// Build Google QueryString
18var googleQ = "http://www.google.com/search?&q=" + sNewText;
19
20// Ask Google
21oWindow.open(googleQ);
22</script>
Open notepad, paste the following code and save it as "google_context_quote.js":
1<script language="javascript">
2// Get the window object where the context menu was opened.
3var oWindow = window.external.menuArguments;
4
5// Get the document object exposed through oWindow.
6var oDocument = oWindow.document;
7
8// Get the selection from oDocument.
9var oSelect = oDocument.selection;
10
11// Create a TextRange from oSelect.
12var oSelectRange = oSelect.createRange();
13
14// Get the text of the selection.
15var sNewText = oSelectRange.text;
16
17// Build Google QueryString
18var googleQ = "http://www.google.com/search?&q=%22" + sNewText + "%22";
19
20// Ask Google
21oWindow.open(googleQ);
22</script>
This will cause two new options to show up in the same menu that pops up when you have selected some text.
"Google As Is" sends a query to google with the selected text just as it is, no quotes.
"Google w/Quotes" does the same as above except it places quotes aroung the selected text.
You only need to restart your browser to get this to start working.
Comments
|
On
1/8/2010
dp
said:
How can this focus on the newly created tab? It opens in the background.
On
1/8/2010
Brian Pautsch
said:
Hi Andrew,
On
1/8/2010
Jerry
said:
Thanks, this is just what I have been looking for.
On
1/8/2010
sylvain
said:
Great -- with IE7, each search even opens a new tab !
On
8/12/2008
Chris hayes
said:
how do i uninstall if i installed from the download code option?
On
8/12/2008
Chris hayes
said:
the scripts how do i uninstall the right click options if i installed from downloading the code?
On
2/1/2007
Andrew
said:
If anybody cares there is a cool ie address bar called Quero that allows you to customize the ie7 toolbars and has some other cool features like a context menu option that lets you search highlighted text using the most popular search engines, including yahoo maps, google etc etc
On
2/1/2007
Andrew
said:
I followed the instructions but it did not work for me. The options appear in the context menu but nothing happens. I moved the two js files to c:\\ but it still did not work. I am sure that it is my fault because my computer programming skills are negative on a 1 to 10 scale. If you have any suggestions how to get things working or how to remove the options from the explorer context menu that would be great.
On
11/16/2006
Brian Pautsch
said:
Sorry don't know. I'll look into it though. Let me know if you figure it out.
On
11/15/2006
Kate
said:
I just wanted to run it by you in hope that you may know;) We wanna add a custom icon to our right-click menu in IE. We have a solution using BHO but it kills google right-click menus and clients don;t liek it. Maybe you have some ideas? Thanks!
On
11/5/2006
Chris
said:
To get IE7 to open the search on a new tab, set IE option to "Let IE decide how to handle tabs" or "Always open pop ups in tab."
|
Leave a Comment