Powering up with Internet Explorer Extensibility


The information published in this post is now out-of-date and one or more links are invalid.

—IEBlog Editor, 21 August 2012

I’ve been keenly interested in extending Internet Explorer since long before I joined the team last fall. MSDN provides some great documentation on how to extend Internet Explorer, but as a longtime IE enhancer, I’d like to highlight some of my favorite resources.

IE provides a number of mechanisms that permit software developers to extend the browser in powerful ways.  You can add:

  1. Toolbar buttons
  2. Tools menu items
  3. Context menu items
  4. Toolbars
  5. Download managers
  6. Pluggable transfer protocols

In addition to (or in combination with) the above extensibility, Browser Helper Objects permit you to power-up the browser with everything from mouse gestures to content-rewriting and beyond.

The first three extensibility points can be extended using registry keys or DHTML alone, while you can plug into the latter three using almost any language: Visual Basic, C++, Borland Delphi, or any of the .NET Framework languages.

Of late, I’ve become a big fan of extensibility mechanism #3.  Context menu extensibility provides a ton of bang for the buck.  Simply add a registry key and a DHTML file, and you can enhance Internet Explorer’s context menu with significant new functionality.

As a demonstration, I put together a small collection of scripts that enable the user to:

  • Remove all non-text elements from the current page
  • Look up the currently selected text in the dictionary or encyclopedia
  • View the source of the currently selected HTML elements
  • Copy any image from the page

Since they’re just DHTML, you can view (and tweak!) the DHTML source of the IEToys by looking inside the installation folder.

Have fun, and feel free to send us suggestions for more toys!

 – EricLaw

Comments (62)

  1. I’m scared of .exe’s – can you post the thing as a .zip of html files and a .reg? Like this one:

    http://channel9.msdn.com/ShowPost.aspx?PostID=106302

    It seems to me that images could be hidden with a simple favelet…

    javascript: var imgs = document.getElementsByTagName("img"); for (var i = 0; i < imgs.length; i++) { var img = imgs[i]; img.style.visibility = "hidden"; } void(0);

  2. Anonymous says:

    [ View the source of the currently selected HTML elements ]

    This is something that should have been inherent in IE – under the "view source" option.

    It would be so-o much more efficient to just SELECT a portion of the page, then right click to see below the "view source" –

    another option to JUST view the "selected" HTML or JavaScript.

    {You could of course use Front Page but it is not always accurate nor efficient}

    BTW: maybe this feature could be added to IE7

  3. Anonymous says:

    Looks fantastic, Eric. However, have you done any security testing? Have some of the SDETs take a look at potential function override attacks, as the plugin probably doesnt have a security context 😉

    And I agree with the above comment that the view selected source thingy should be added as a feature in ie7. that would own so much

  4. Anonymous says:

    Maurits: The executable is digitally signed by me (Eric Lawrence) to prevent tampering. Why? It’s easier for the average user to check a digital certificate than to examine a .REG file to decide if it’s malicious. There are other downsides to a .REG file, including that manual editing of the .HTM files would be required to install to a non-standard installation path; this would be required to uninstall as well.

    Yes, virtually anything that can be done in a Context Menu extension can be done as a "favelet" as well. I find the context menu convenient, but your mileage may vary, of course.

    Paul, I encourage you to take a look and let me know offline if you find anything interesting/evil. Thanks!

  5. Anonymous says:

    Eh I have a dream. I actually implemented it with a Dhtml javascript class myself, which by the way works on IE only.

    But I’d like to have the feature in the browser.

    That is, I select a text in a page with my mouse, and the text gets underlined via dhtml. This allows me to use a web page as I would use a book, and, partticularly if the text is long, trace back soon the portions I liked.

    I underline a lot my books here. Many other persons do.

    It’s like reintroducing in the new medium a Gutenberg feature.

    I double click what I underlined and the portion double clicked is no longer underlined.

    As I said, I implemented this. The fact I could nest such a thing in the Registry was something I wasn’t aware of. That’s terrific.

    Yet why I’d like it as embedded _already_ in IE7? Because in this way once I have finished underlining, I could choose a context menu that says, say: "Save Excerpts" – and it should auto produces a txt file already SAVED with:

    date, original URL, document Title and all the texts I underlined.

    That is, it’s the saving that I can’t implement via my dhtml only. I can extract exceprts, but then I still have to paste into an external editor launched on purpose.

    It has also considerable educational purposes: one could extract portions of say a Shakespeare drama read online by merely underlining it.

  6. Anonymous says:

    Is it possible to prevent Explorer from being customized by third-party tools?? For example, as an author, I require my installation of Explorer to be as default as possible for screenshots and the like. Installing things like the CD distributed with Comcast High Speed Internet service, for example, replaces the default IE icon, and adds loads of garbage to the toolbars. Of course, I’m savvy enough to look up the information on how to remove all that (and have since figured out not to install all that in the first place), but I’d rather just click a button that says "don’t allow third party tools to customize Explorer — ever". So many programs want to screw with Explorer and add all this junk I’ll never use, I’d just rather they didn’t. So while I see the benefit of being able to customize Explorer in this way, for me personally it’s been more annoying than helpful.

  7. Anonymous says:

    Richard– You can turn off "Enable third-party browser extensions" in the Tools | Internet Options | Advanced menu to turn off some forms of customization.

    I generally avoid installing anything that mucks with settings in a way I don’t like. At least for my connection at home, the Comcast CD isn’t required to use the high-speed connection.

  8. Anonymous says:

    Looks good from a security standpoint. Keep up the good work 🙂

  9. Anonymous says:

    Eric Law over at the IE blog shares his interest and resouces for extending IE.

    &quot;IE provides a…

  10. Anonymous says:

    An underline feature can be implemented via this script, nesting it with the guidelines at:

    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/menuarguments.asp

    On my IE it works. I derived it from my dhtml, but of course I stripped off a _lot_ of stuff and I have not included in it the remove underline feature and the extract underlined texts.

    What I’d like is sort of this as a default in IE with the option to extract and _autosave_ as txt the underlined portions.

    Not (not) going to post more code, not even to correct typos or possible misconceptions or so. Just as a working draft written in 30 mins. I am not aware whether there are guidelines against posting a bit of codez (Mauritz did); so apparently none, if any, I apologize in advance. Anyway since Eric asked, I guess it’s on topic.

    <SCRIPT LANGUAGE="JavaScript" defer>

    var parentwin=external.menuArguments; var doc=parentwin.document; var amount=0;

    function mouseUp(e){

    if(doc.selection){ if(doc.selection.type.toLowerCase()!="text"){return true;}

    var range=doc.selection.createRange();

    if(!range.text/*no text selected*/){return true;}

    engine(range, parseFloat(doc.body.scrollTop), parseFloat(doc.body.scrollLeft));}}

    function engine(range, pageOffsetY, pageOffsetX){

    var lines=range.getClientRects();

    for(var l=0; l<lines.length; l++){

    create(lines[l].top + doc.body.scrollTop – 2, lines[l].left + doc.body.scrollLeft, lines[l].right – lines[l].left, lines[l].bottom – lines[l].top

    );}}

    function create(top, left, width, height){

    var div=doc.createElement("DIV"); div.id="anId"+(++amount);

    div.style.cssText="position:absolute; top:"+top+"; left:"+left+"; width:"+width+"; height:"+height+"; background:transparent; border-bottom-style:solid; border-bottom-color:#000000; border-bottom-width:1px;";

    doc.getElementsByTagName("BODY")[0].appendChild(div);}

    mouseUp(parentwin.event);

    /* code oversimplified by original

    http://www.unitedscripters.com/scripts/dhtml19.html */

    </SCRIPT>

  11. Anonymous says:

    Event argument unnecessary. A relic from the original.

  12. Anonymous says:

    Microsoft needs to seriously force some sort of quality and security filtering before ANY addon is allowed to plug itself in. Otherwise you end up with this…

    http://www.jabcreations.com/temp/browser_bugs/ie/internet_explorer.jpg

    Security issues still mostly stem from IE addons. Figure out a way to deliver only what the user DOES want with reassurance from a third party that what they are about to install isn’t something shady or just plain junk.

  13. Anonymous says:

    <Microsoft needs to seriously force some sort of quality and security filtering before ANY addon is allowed to plug itself in.>

    That’s the "Cancel" button on the dialog that says "Do you trust this code?"

    It’s misleading to imply that IE is uniquely vulnerable to the user making stupid decisions.

  14. Xepol says:

    Personally, I would like to see more about creating IE plugins like Toolbars with dotNet (C#, VB.NET, whatever).

    I’m not satisfied with the current links toolbar, and if I can’t get what I want from MS, I’ll just write my own. Now, I could go off, fight with the language barrier and get something working in Delphi, but I would rather have a chance to do some useful work while sharpening my dotNet language skills.

    Just a thought.

  15. Anonymous says:

    Xepol: Try the ".NET Framework" link in the post. It provides a great base class for building a toolbar for IE/Explorer in C#.

  16. Anonymous says:

    Some useful stuff Eric. Many thanks! 🙂

  17. Anonymous says:

    Putzed around with the toolband sample code. It could use a little bit of updating. Couple errors in the source due to string safe updates and no DllUnregisterServer function which means no uninstall.

    It would be nice to have a real downloadable visual studio solution, had to copy and paste all the files off MSDN then make my own export definition file to get it to work with regsvr32.

    Coding in the shell is pain enough without struggling against sample code :).

    The ATL approaches on code project seemed ok, but looked more abstracted than I want to deal with. I didn’t want to deal with some third party wizard install.

  18. Anonymous says:

    <It’s misleading to imply that IE is uniquely vulnerable to the user making stupid decisions.>

    Still there should be "uninstall extension" or "Undo install" to help the user. Even if he have been treaked into installing something.

    < Eh I have a dream. >

    Have use seen http://www.w3.org/2001/Annotea/ project?

    < View the source of the currently selected HTML elements >

    Mozilla has it 🙂

    And there should be both – "View downloaded source" and "View current DOM source" (part of it is selection source).

  19. Anonymous says:

    Some if not all this (but + a whole lot more) is available with the NILS accessibilty toolbar (http://www.nils.org.au/ais/web/resources/toolbar/index.html).

    If you like what Eric has done I think you will like this even better ;-).

  20. Anonymous says:

    I just installed:

    http://www.microsoft.com/windows/ie/previous/webaccess/webdevaccess.mspx

    under IE 6.0.2900, View Partial Source seems to work (although if the thing you right-click on happens to be a hyperlink View Partial Source is not available on the context menu). Document Tree sort of works (trying to drill into ‘all’ or ‘childNodes’ generates a tonne of errors) after I edited %SystemRoot%Webtree.htm to include

    <HEAD>

    <!– saved from url=(0014)about:internet –>

    </HEAD>

    It added itself to Add/Remove Programs and removed itself cleanly.

    Maybe Eric could update and extend these tools for IE6 and make them part of an official but unsupported IE6 PowerToys collection.

  21. Anonymous says:

    for Maurits:

    I tweaked your bookmarklet so that it will work in all browsers (read: Uses the Standards supplied by the W3C, DOM and ECMAScript references)

    So, ‘visibility’ is now ‘display’, and I also cleaned up the incorrect double quotes, the var declaration inside the for loop (redundant redefinition)

    javascript:var imgs=document.getElementsByTagName(‘img’);var img;for(var i=0;i<imgs.length;i++){img=imgs[i];img.style.display = ‘none’;}void(0);

    Now you can use this in any Web Browser! 😉

    Note: IE users will have to click on a security warning dialog, because IE’s version of JavaScript *can* access the OS.

    Thanks,

    Jack

  22. Anonymous says:

    The Internet Explorer 5 Web Developer Accessories add-on (http://www.microsoft.com/windows/ie/previous/webaccess/webdevaccess.mspx), cited by Grant Wagner above, also provides a partial-source-view component that works in IE 6.

    Keep in mind that both the IE 5 accessory and the HTML Source tool provided by EricLaw produce the _rendered_ HTML source, not the raw HTML source. The rendered source is the byproduct of IE’s parsing engine, and will usually look different from the raw source. This can be a helpful tool because it allows you to view the code as modified by script, as well as how Internet Explorer itself sees your code. But if you want to see the raw HTML code produced by the page author, you will need to perform a traditional View Source.

  23. @Eric: I must admit that wasn’t the response I was hoping for. Sure, I can verify that *you are the author* of the .exe, but I still *have to trust you* without being able to review the code first. Personally, I’m comfortable reviewing .reg files.

    @Jack: Thanks for your help 🙂 But, a couple of things…

    * visibility /is/ standard CSS. I chose visibility rather than display because visibility doesn’t reflow the page like display does. Of course, maybe a reflow is what we want… it depends whether the annoyance is due to flashing gif’s or just loss of screen real estate. So both versions are useful.

    * Double-quotes should be fine AFAICT

    * I put the var img inside the for loop because that’s the only place it’s needed. I have a personal code style rule that variables should be declared within the smallest scope in which they are needed.

    * Perhaps a background-image catcher is necessary too… and <object> and <iframe>… and <embed>…

  24. Anonymous says:

    Is there any way to look at the elements of a webpage (think "View Page Info" in Firefox)?

  25. Xepol says:

    Eric, yes, there is a link to a third party kludge that doesn’t work worth beans. Aside from the fact that it can’t install properly, can’t uninstall properly, and whacks your toolbars when you DO install it, it is a KLUDGE.

    I would like to see REAL integration with dotNet. I would be nice if the dotNet code didn’t have to carry around an extra DLL to pretend it was something it wasn’t. Wouldn’t it be nice if IE was capable of using dotNet code directly, without all the kludging and uglyness?

    That, perhaps, is more what I had in mind.

    That said, I am playing with the bad kludge. We’ll see if I can do anything useful with it.

  26. Anonymous says:

    Xepol– Sorry to hear you didn’t like the sample. I’ve used it internally to great effect for prototyping new IE7 features. I haven’t run into any installation or uninstallation problems, but perhaps the comments at CodeProject can help you out with that.

    The .NET Framework inherently carries around separate DLLs for Interop with COM; it’s a design decision they made. Having written IE extensions in VB, C++, .NET, and Delphi, I’m happiest with the results I was able to get with C#.

    C# is my primary language, and I agree that greater IE integration with .NET would be most excellent.

  27. Anonymous says:

    I leveraged the extensibility of IE to build an address bar replacement toolbar (http://www.quero.at/). I really enjoyed the IE platform so far and the excellent documentation on MSDN. One thing I miss is an interface to handle changes made to the DOM tree by scripting. This would be very useful for content rewriting systems.

    I am still hoping that the final release of IE7 will have the same toolbar layout flexibility like previous versions of IE had. Please allow the user to turn off the address and tab bar separately.

    BTW there is a bug in the context menu UI handler of IE: if I double click and instantly right click a word to let’s say perform a cursor search on that word, IE opens the wrong type of context menu (the context menu for the whole page instead of the context menu for the text selection). To reproduce the bug you have to click sufficiently fast.

  28. Anonymous says:

    The above mentioned bug can be easier reproduced by selecting a text block and then double clicking on a word in it. Afterwards right click on the word to see what I mean.

  29. Anonymous says:

    What sort of schedule are we looking at for further betas and then a public release?

    At the company I work most of the developers are still working on win2k boxes – if IE7 is going to be XP only we’ll need to upgrade to XP.

    When it’s made publically available will it be a windows update thing – IE 90% of XP users will switch from IE6 to IE7 overnight?

    Is it going to be possible for us to run IE7 side by side with IE6, either officially or using the files that currently let me near-as-needs-be run IE6/IE5.5/IE5 on my win2k machine?

    Cheers!

  30. Anonymous says:

    Viktor: Good bug, thanks. I’ll get it filed.

    Seb: Yes, IE7 will require XPSP2 or later. I don’t think we’ve yet disclosed future release dates. Running side-by-side will not be a supported scenario, but if you’re doing this today, the same tricks may continue to be available.

  31. Anonymous says:

    Hello.

    Great tips. BTW, I use Adrian Batemam’ IEPRint for fit-width printing:

    http://adrianba.net/archive/blog-7826f25163ca406caee7ec2c11066a75.aspx

    Is it possible to add this feature into right-click menu?

    Also, is it possible to add "Print selection"

    into same menu?

    Thanks for answers.

  32. Anonymous says:

    I would like to do the opposite: I’d like to remove the following items from my default context menu: ‘Set as Background’, ‘Copy Background’, ‘Set as Desktop Item…’

    Any idea how? I’ve tried rummaging around the registry, but to no avail.

  33. Anonymous says:

    I’m really going on a tangent here but since you mention mouse gestures.

    I’d like to point out that obviously the average (lazy) user will only use what’s already provided for him.

    On that note I sure hope IE7 has basic support for features that are normally resolved for plugins. I’d like to see a couppe mouse gestures enabled within IE (right click, hold and move left for back, and right for forward, up for open link in a new tab, down for home). And I sure hope IE7 final has at least a bare bone download manager that will officially continue downloads if a connection is lost.

    I’m not asking for the whole ball of wax, but in today’s world these are neccesities of browsing.

    Obviously the real icing features like spell checking will be reserved to either OS based support or a plugin.

  34. Anonymous says:

    <<I’d like to remove the following items>>

    Arun: Sadly, we don’t offer a simple way to do this inside IE. It’s possible to use IDocHostUIHandler to customize context menus, but this is nontrivial. <<http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/reference/ifaces/idochostuihandler/idochostuihandler.asp?frame=true>&gt;

    We are doing some cleanup of this menu in IE7.

  35. Anonymous says:

    <<I’d like to point out that obviously the average (lazy) user will only use what’s already provided for him.>>

    I agree that this would be nice to have "in the box", but average users typically aren’t those that either understand or want mouse gestures.

    <<sure hope IE7 final has at least a bare bone download manager that will officially continue downloads if a connection is lost.>>

    As mentioned in a recent Beta-chat, IE7 will not include a download manager. There are a number of good download managers which plug into IE’s IDownloadManager interface. Even without a download manager, IE will resume a download if the remote server supports Range-requests and assuming that you haven’t cleared your cache. (There is currently a limitation that you must not try to restart the download until the connection is active again lest you lose the cache file.)

  36. Anonymous says:

    For a cool walkthrough tutorial on writing your own context menu extensions (with lots of examples) check out: http://www.siteexperts.com/tips/hj/ts01/samples.asp

  37. Anonymous says:

    Why does the IEBlog show up as 7 duplicate entries for each single entry in Thunderbird?

  38. Anonymous says:

    How about bittorrent build in support ? Opera already has it, will it be added in IE?

    Visit http://www.madtorrent.com For Easy Torrent Search

  39. Anonymous says:

    I spent quite some time on remembering and documenting a lot of bugs in Internet Explorer 6, and listed features that would be a great addition to Internet Explorer 7. I hope it’s not too late to be useful for the developers!

    I posted it in my blog (anonymous comments enabled): http://www.livejournal.com/users/tmaster/32935.html

    Please include my nickname if you wish to reply in IEBlog instead of mine 🙂

    Please check it out, I’d like to receive any corrections and/or answers about which bugs will and will not be fixed, or which features will be implemented.

    And my compliments for this blog post, I consider myself a power user, yet didn’t know you could extend IE in such a way, while not needing a lot more than knowledge of scripting languages!

  40. Anonymous says:

    I like the idea of extensibility, but I really really would like the stop and refresh buttons to be put back first 🙂

  41. Anonymous says:

    Eric – FYI, the IE Toys show up in Microsoft Anti-Spyware with a "High" security threat.

  42. Anonymous says:

    Eric Law over at the IE blog shares his interest and resouces for extending IE.

    &quot;IE provides a number…

  43. Anonymous says:

    i’m a BHO developer, eric.

    with IE7, my bho fails immediately on

    the Navigate() call to IWebBrowser2.

    i’m guessing this is due to CUri or

    something close to it.

    can you elaborate on this or

    when there will be some documentation

    available?

    thanks for any info…

    hong

  44. Anonymous says:

    Hong– Please let me know what URLs you’re trying to Navigate to… CURL should not be breaking this in anyway.

    My email address is ericlaw at microsoft dotcom.

    Thanks,

  45. On Episode 22 of the Desert Skies podcast we cover some of the new exciting features of Window-Eyes…

  46. On Episode 22 of the Desert Skies podcast we cover some of the new exciting features of Window-Eyes…

  47. IEBlog says:

    Hey! I’m Pete LePage, one of the Product Managers for IE and I’ve been around Microsoft for some time

  48. Building AddOns for Internet Explorer Could Net You A Trip To Mix07 and $2500!As part of the IE7 launch, we want you to create your own AddOns, and I think we’ve got a great way to encourage you to do this. How about the best AddOn submitted between N

  49. Interesting competition over here about building an add-on to IE7 and winning yourself some cash and…

  50. I added the ish bit because while it may not cost you any money, it may cost you time. The IE team have

  51. develop an internet explorer addon

  52. Phil Reinemann says:

    Some of the links give 404 not found errors, including msdn.microsoft.com/…/default.asp and msdn.microsoft.com/…/default.asp.

    I know this site has a lot of old info, so how are add-ons created now for IE9 in 2015?

Skip to main content