The "script language" tags MUST stay in the .js files.
This involves making changes to your registry, as with all changes to the registry it is recomended that you backup your system prior to trying this.
To add "Google search" to your IE context menu like firefox has, here's how.
According to Microsoft, this method of adding context items should work as early as IE4.
Open notepad and paste this, (NOTE: You can change the paths to the js files if you want, just make sure you put the files where this says they are.)
| Code: |
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google As Is]
@="C:\\google_context_noquote.js"
"Contexts"=hex:10
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google w/Quotes]
@="C:\\google_context_quote.js"
"Contexts"=hex:10 |
Save as a .REG file, right-click and select merge.
Now paste theese two sniplets and save as the two js files that the reg file points to.
google_context_noquote.js
| Code: |
<script language="javascript">
// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;
// Get the document object exposed through oWindow.
var oDocument = oWindow.document;
// Get the selection from oDocument.
var oSelect = oDocument.selection;
// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();
// Get the text of the selection.
var sNewText = oSelectRange.text;
// Build Google QueryString
var googleQ = "http://www.google.com/search?&q=" + sNewText;
// Ask Google
oWindow.open(googleQ);
</script> |
google_context_quote.js
| Code: |
<script language="javascript">
// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;
// Get the document object exposed through oWindow.
var oDocument = oWindow.document;
// Get the selection from oDocument.
var oSelect = oDocument.selection;
// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();
// Get the text of the selection.
var sNewText = oSelectRange.text;
// Build Google QueryString
var googleQ = "http://www.google.com/search?&q=%22" + sNewText + "%22";
// Ask Google
oWindow.open(googleQ);
</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.
_________________
Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Last edited by quantum on Mon Aug 09, 04 1:31 pm; edited 1 time in total