Click here to Skip to main content
15,880,392 members
Articles / Web Development / HTML
Article

Internet Explorer 5+ Extensions

Rate me:
Please Sign up or sign in to vote.
4.38/5 (11 votes)
13 May 2005CPOL3 min read 48.3K   427   24   6
A variety of new and used Internet explorer extensions available from a 'right click'
Sample Image - ieextensions_menu.gifSample Image - document_scripts.gif

Introduction

I first came across useful extensions for Internet Explorer when Microsoft packaged IE4 Power Toys. Things seemed to then go quiet for IE5, so I took the ideas, and with a little help from an MSDN article, I created a few more useful bits and pieces for IE.

Included Extensions

  1. Show / Hide table borders (for page) - useful for web development / layout.
  2. View Selected Source (for selected text) *
  3. View Stylesheets (for page).
  4. View Scripts (for page).
  5. Highlight (for selected text) *
  6. De-highlight (for selected text) *
  7. Zoom In (for selected image) *
  8. Zoom Out (for selected image) *

* From IE4 Power Toys.

How does it work?

The whole thing works entirely in HTML/JavaScript, and the knowledge that IE can grab a read-only copy of the document currently loaded in the browser. This means that these extensions are extremely useful for labour saving on working out the makeup of a page.

What can you do?

The most useful thing is that you have access to the document object through the following JavaScript code.

JavaScript
var win = external.menuArguments;
var doc = win.document;   //Owning document

These lines then allow you to address doc as a normal document object.

The 'Show / Hide Table Borders' page is implemented as simply as the following JavaScript:

JavaScript
<SCRIPT>
    var win = external.menuArguments;
    var doc = win.document;
    for (i=0;i<doc.all.tags("TABLE").length;i++) 
    {
        if (doc.all.tags("TABLE")[i].border == 0)
            doc.all.tags("TABLE")[i].border = 1;
       else
            doc.all.tags("TABLE")[i].border = 0;
    }
</SCRIPT>

Points of Interest

New Windows

Some of the pages create new windows. The important thing to remember is that you can only operate 'read-only' on the currently loaded browser document. This means that if you want to show some information about the page you'll most likely need to create a new window. The following pages (in the installation) give examples of this:

  • showstylesheets.htm
  • viewselectedsource.htm
  • showscripts.htm

Issues

I found that there are a number of pitfalls...

  1. Frames tend to be problematic, as the sandbox the script runs in may not have access to look at other frames.
  2. If you're intending to pop up a window to display some information, then make sure you don't have any popup blocker running (else you'll get a permission denied error).
  3. You may also find that some properties that you can see in a debugger can't be accessed through this code. I found this was the case in IE6 with properties like document.location (you can use URL instead, however).

Hooking it all up

The HTML files can go anywhere, but normally go into %systemroot%\web (e.g. c:\windows\web or c:\winnt\web), and the context menu comes from registry entries found at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt.

Each item can apply to different contexts (see the MSDN article for details on implementing that).

Installation

I chose to use Visual Studio .NET to create a Windows Installer package (I previously used a .inf file). This will copy the HTML files to c:\IEExtensions and create appropriate registry entries. I chose this folder location as I didn't get round to putting conditions in the installer based on the operating system!

Make sure you close down all instances of IE as the extensions won't show up until IE loads from scratch again.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Codebureau
Australia Australia
Started with COBOL/CICS/DB2 - ended up with C#/ASP.NET. I'm a half-geek (or so my wife tells me!)

Comments and Discussions

 
Generalinstallation Pin
NeverHeardOfMe16-May-05 2:37
NeverHeardOfMe16-May-05 2:37 
GeneralRe: installation Pin
NeverHeardOfMe16-May-05 4:24
NeverHeardOfMe16-May-05 4:24 
Generallink broken Pin
tom_dx13-May-05 15:09
tom_dx13-May-05 15:09 
GeneralRe: link broken Pin
CodeBureau - Matt Simner13-May-05 15:56
CodeBureau - Matt Simner13-May-05 15:56 
GeneralRe: link broken Pin
Anonymous13-May-05 22:50
Anonymous13-May-05 22:50 
GeneralRe: link broken Pin
CodeBureau - Matt Simner14-May-05 2:27
CodeBureau - Matt Simner14-May-05 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.