Extracted From Ankit Jain Ye Meri Life Hai!

Let’s go through Internet Explore for writing the simplest extension in just 5 minutes. So, what we wanted to do? Here I will show you how to access Html Dom and change it on the fly. All you need to know is a JavaScript and simple programming concepts. Here are the steps on MSDN that details adding a context menu to Internet Explorer.

Open Registry Editor and point it to HKEY_CURRENT_USER\Software\Microsoft\InternetExplorer\MenuExt
Create a new key that represents the text on the context menu. This may include ‘&’ for keyboard shortcut.

Create a blank Html file, say myMenu.html and open it in notepad. Clicking on the new item in the context menu this is the script file which gets executed. Point the default value of the key (created in the step 2) to this html file.

Create a binary value Contexts, and sets its value as 0×1. This can be 0×2 if you want our item to appear when we right click on an image. Or 0×10 if it should appear only it some text is selected. These values can also be binary OR-ed with each other.

Now open IE and right click (as whatever contexts you have set), you can see your new text appearing in the menu. Then we need to handle the event that Internet Explorer sends to the myMenu.html file. This should contain a script block. It receives an event as external.menuArguments. This menu argument contains a document object that is same as what we use in JavaScript to access the html of the webpage.

Read More