Check this out. Have you ever wanted to add functionality to Internet Explorer? Say you want it so that when you have a word selected, you can right click and have it look that word up at
http://www.dictionary.com ?
Well here's how you do it. From this you could dream up a bunch of other things I'm certain. Hey, maybe you can create your own cool thing and stick it here too. With Javascript I'd think you could do a ton of things, like maybe...
- An Ebay item ID lookup script
- a Yahoo Mail mail sender (now, when you click on a mail address IE will pop you to Outlook or Eudora). In this case, maybe you could take the cursor position and then scan left and right to parse out the email address. Probably more fun to do than useful.
- ???
For your convenience I put the registry file and HTML file below. Just run the
.reg file and put the
.htm file in
c:\iemenu. Or, learn how it's really done and do these steps...
- Launch
regedit
- Find the key
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\
- Create a new key. In our example, create one called
Dictionary
- Make the
default value for the key equal to file://c:\iemenu\testscript.htm - which is an HTML file which we'll create shortly.
NOTE: Now, I think with pre-Internet Explorer 5.0 you could just stick a URL there with a substitution string. But I couldn't get this to work. Google's tool bar has a DLL which they install on your machine as the target. The way we'll do it is cooler anyhow.
- Create a binary value named
Contexts and set it to 30 00 00 00
- Ok, we're done in the registry. Close up.
- Now create the file
c:\iemenu\testscript.htm and make it look like this.
<SCRIPT LANGUAGE="JavaScript" defer>
str = new String("http://www.dictionary.com/cgi-bin/dict.pl?term=")
var parentwin = external.menuArguments;
var doc = parentwin.document;
var sel = doc.selection;
var rng = sel.createRange();
var selectedStuff = new String(rng.text);
str = str + selectedStuff
parentwin.location = str
newWin.location = str
</SCRIPT>
- Ok, you're done. Try it out!
--
MattWalsh - 18 Dec 2001