Create A Context Menu Item To E-Mail An IE Page


How would you e-mail a page in Internet Explorer by right-clicking on it? If you get this in your mind, here is the solution to it. Using this method you can send pages from Internet Explorer. It involves a simple registry hack with a small tweak. It is as follows..

1. Start the Registry Editor: Start > Run > type regedit > [Enter]. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer. If you do not see a key called MenuExt, create one with that name.

2. Under MenuExt, create another key and call it Email Page. This is the text for the custom context menu item.

3. You also need to specify under what conditions this menu item is to be shown. For example, you may want to show it when you click on anchor elements, or for the main document and not for text boxes, and so on. This is specified by a value called Contexts. Add a DWORD value under Email Page and call it Contexts.

Set the value for this to 1, meaning that it is shown for the default context menu. You can also use the values below to change the conditions for the menu:
Context               Value
Default                   0x1
IImages                  0x2
Controls                  0x4
Tables                    0x8
Text selection         0x10
Anchor                   0x20

4. Now specify the action to be performed on clicking this menu item. This is done by specifying the location of a script, which can be JavaScript or VBScript. Set the default value of your context menu key to the location of a HTML file; for example, C:\Email.html

5. Type the following code in Notepad and save the file as C:\Email.html:

<SCRIPT language=javascript defer>
// Declare variables
var oExtArgs =
external.menuArguments;
var sTitle =
oExtArgs.document.title;
var sUrl =
oExtArgs.location.href;
// Create IE object
var oIE = new
ActiveXObject(‘InternetExplorer.Appl
ication’);
if(sTitle == ”)(sTitle = ‘No
Title’);
// Escape title and URL
sTitle = escape(sTitle);
sUrl = escape(sUrl);
// Build mailto string
var sMail = ‘mailto:’ +
‘?subject=’ + sTitle + ‘&body=’ +
sTitle + ‘: ‘ + sUrl;
// Load mailto string IE
oIE.Navigate(sMail);
</SCRIPT>

You should now see the extra menu item in IE, and be able to e-mail the page using your favourite mail client.Try it..!!

Filed under: Tips n Tricks
Tags: , , , , , ,
September 2, 2008 by: Prasanth Chandra

Comments

Leave a Reply to Speed Up Vista