Home > CodeProject, Technology > Extending Internet Explorer – Scenario based overview

Extending Internet Explorer – Scenario based overview

For one of my projects, I was working on a minor enhancement. The project was web-based and as per client’s requirement, run only on Internet Explorer. The enhancement was related some data input page but access to any part of the site was restricted by a Login page.

The login page, as like any, consisted of a very minimal input – the username and password. But any change or recompiling on the site made me go from the login screen. Since it was a pretty old (almost a decade), it never had or no one bothered to put a “Remember me” check box. So logging in through the main screen was pretty customary.

I quickly considered the other alternative of hardcoding the values into the code, or at least till the release was made. But the idea of making temporary fixes to code for my pleasure nauseated me immediately.

What I was looking for, was a very efficient way to give me a quick form fill feature on the browser without having to mutilate the project in any possible way. May be Internet explorer had an option of extending itself! Fortunately it did and I finally figured out a way to do exactly that.

What would be the outcome? The outcome of this simple hack procedure would provide me with a new item on the Right click menu on Internet Explorer. On clicking upon such menu item, the fields on my form (website) would be auto filled with pre-set values.

Where all can I apply this hack? This procedure would specifically suit Internet Explorer browsers of versions anywhere in 6, 7 or 8. Although this has not been tested on very recent releases of Internet Explorer. If you’re using browsers like Chrome you have other ways of extending the browser functionality, this is just for my fellow developers like me who have no other browser to turn to except IE.

Can we get on to the hack already? Yeah sure.

All I need for this hack would be:

  • A registry entry
  • A simple javascript function

Registry entry: The whole purpose of the registry entry is to add the menu item to Internet Explorer’s context sensitive menu. As far as my knowledge goes, there isn’t a straight way of doing this than to go for a registry edit.

Warning: This section involves a registry edit. Altering registry settings without proper care might render the operating system useless. Kindly ensure necessary precautions before proceeding. Hazmat suits advised. Alternatively, you can visit this link to back up your registry settings.

  1. Enter regedit in your run command prompt.
  2. In the registry editor, navigate to the following tree-child.
  3. HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\
  4. Create a new key under this tree element, by any name “XYZ” of your choice.
  5. Under the registry item “XYZ”, add the following String Values as below:
  • String Value: CLSID
    • Value: A guid like {1FBA04EE-3024-11D2-8F1F-0000F87ABD16}
    • PS: You may use any GUID generator to get such a string
  • String Value: Menu Text
    • Value: My Menu Extension
    • PS: This text would appear on your Internet Explorer context sensitive menu.
  • String Value: Exec
    • Value: Path to the HTML file, you’ll be coding in the next section.
    • Example – C:\MyFolder\MyFile.html

JavaScript function:

  1. Place a simple javascript code to do the job of the form filling in a html file.
  2. Copy the location to this html file and place in the above registry item’s, Exec value.
  3. Restart your internet explorer
  4. Navigate to your page, a right click on it – you must see “My Menu Extension” on the right click menu.
  5. Click on it to perform the tasks you’ve coded in the javascript function. Or in this case, it would fill two textboxes txtUserId and txtPassword with corresponding values.
<Script language="JavaScript">
var parentwin = external.menuArguments;
parentwin.document.forms.txtUserId.value ="UserName";
parentwin.document.forms.txtPassword.value ="Password";

Well, that’s how I solved my requirement with a simple concept of extending Internet Explorer. The possible areas of further work I looked into were

  • Filling huge web-forms (repetitive tasks) for let’s say testing purposes with the ease of a right-click menu item
  • Automating using a excel macro to create the registry entries and their corresponding javascript function for different sets of values provided. Basically abstracting the user from the nitty gritties and allowing him just the final piece of cake.

For a very detailed look into various customizations on Internet Explorer, check this link

  1. No comments yet.
  1. No trackbacks yet.

If you have something to say about the post, please do. Positive criticism and comments always welcome!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: