Extend Everything

As of December 2011, this topic has been archived. As a result, it is no longer actively maintained. For more information, see Archived Content. For information, recommendations, and guidance regarding the current version of Internet Explorer, see Internet Explorer Developer Center.

Tom Moran
Rafael M. Muñoz
Kusuma Vellanki
Microsoft Corporation

May 1, 2000


Selecting smartly—Extending SELECT behavior
Magic made easy—Extending the functionality of the browser
Where are my controls?—Bring them down

The Web Men Talking Award—Planet Source Code
The Web Men in Short

Reach a little. Push that code. This month, the Web Team of Rafael, Tom, and Kusuma show how you can add a few extras. For our part, we'll work on adding Kusuma's picture.

Extending SELECT behavior

Dear Web Men:

I used to be a long-time Visual Basic programmer. One of the things I missed was the combo box control, where the user can type in the first a few letters of the item he wishes. I can even then program it to do incremental search through the list items. How do I implement such a thing in Internet Explorer 5 DHTML? Is it possible?


James Yin

The Web Men Reply:

James, here's a behavior that one of our developers, Burt Harris, whipped up. You can perform an incremental search through an unsorted list. The search also wraps when it reaches the end of the list. Let us know what you think about it.

The sample consists of two files, Select-code.htm and Select.htc. They can be accessed at the buttons below. They are a little longer than usual, so we are linking to them instead of having them inline.

View the code.

View the sample.

Magic made easy

Dear Web Men:

I have seen software change the toolbars in Internet Explorer, either adding some buttons to launch their own applications or performing other functions when the browser comes up. What kind of magic are they using to do this?

Helen Johnson

The Web Men reply:

"Hey, Rocky! Watch me pull a rabbit out of my hat."

We might be aging ourselves with that one. Actually, Helen, the magic is simple: It involves extending the browser, which allows you to keep the browser's default functionality while adding your own flair.

MSDN Online has some great information on this topic of Browser Extensions. Pay close attention to the style guides—because while it's great that we are adding to the browser, we must keep in mind that many users are already familiar with Internet Explorer Non-MSDN Online link. We don't want to confuse the user with our additions; we just want to enhance the experience.

You'll also find some great tutorials and even some examples of what you can do when extending the browser. We thought it would be great to add a button that would take you directly to our column. Something like:

Web Men button

If you are interested in more than enhancements—and you want to run some of your own code every time the browser comes up—check out Browser Helper Objects (BHOs). Besides enhancing menus and toolbars, BHOs allow you the ability to detect typical browser events, install hooks to monitor messages and actions, and much more. A wonderful article that describes BHOs in detail is "Browser Helper Objects: The Browser the Way You Want It."

Where are my controls?

Dear Webmen:

You are my last hope of solving a seriously frustrating problem. I have compiled ActiveX components on my HTML page, but the component doesn't pull up on all machines in my department. Every machine uses Internet Explorer (either 4.0 or 5), but on some machines the entire app comes up (probably not coincidently, these machines also have Visual Basic installed on them), and on others only a tiny gray square shows up. The security on all machines is set to allow all ActiveX components.


John Hagen

The Web Men Reply:

John, this is the most frequently asked question—and the source of baldness for several people. When it comes to downloading components over the Web, the developer needs to take care of several things:

  1. The first step is to ensure that you have packaged the components and all of the dependencies. For Visual Basic components, you can use the Package and Deployment Wizard (PDW) add-in to build an Internet Package. If you are using other controls, such as the Microsoft Common Controls, you need to package these as well. Typically, the PDW will pick up these dependencies when packaging your component.
  2. The second step is to make sure that the client machines have security settings enabled to download signed/unsigned ActiveX components for the particular ZONE you are interested in (for example, Intranet or Internet). This corresponds to the first two settings grouped under ActiveX controls in the Security tab of the Internet Options dialog box. If your security settings are set to "Prompt," you will see a dialog with the following prompt: "Do you want to install and run 'Your package name'"; note that this is different from the security prompt regarding scripting and initialization of the component, "An ActiveX object on this page may be unsafe. Do you want to allow it to be initialized and accessed by scripts?"
  3. Still nothing shows up? There are several resources to help you troubleshoot what went wrong with the download. Look in your Temporary Internet Files folder for a error log filename that starts with "?CodeDownloadErrorLog" and contains the CLASSID of the component you are trying to download. This log file is a simple HTML file that you can drag onto Internet Explorer. It contains detailed information about why the download failed.

Want to know more about how download works and how to troubleshoot download issues? Here are some excellent resources to help you out

The Web Men Talking Award

This month's award goes to Planet Source Code at http://www.planet-source-code.com/ Non-MS link. Even if it were only a simple source code library, it would merit Favorites standing. But it is more than that. The site's builders have collected tons of source code for Visual Basic, JavaScript, C++, and ASP. They give you a continually running source code ticker showing all the new stuff, a "Code of the Day" mailing list, and a list of recent tutorials. The site has also started to accept articles, so we expect it to become an excellent content repository, as well.

Planet Source Code has a short survey directly on the main page to find out how you feel about specific ideas. If they implement even half of those, they will definitely be one of the top sites in our book. The discussion lists seemed to be fairly active, and the site sponsor monthly coding contests. The code center allows public discussion and rating of the code or sample, which is great—and something you're used to from MSDN. All in all, this is a great site, although a speedier search would be a nice addition. We definitely appreciated the fact that the site had only two small advertisements at most on a page, and that it was very friendly to beginners and advanced programmers alike. The authors of this site have definitely done their homework, and are in touch with what their developer community needs.

The Web Men in Short

Q: Michael Hargreaves wants for information on the shortcut icon seen in the address bar of the browser.

A: Refer to How to Add a Shortcut Icon to a Web Page.

Q: Veronica Burbano wants to reload/replace a page being viewed in a Web modal dialog. Setting location property causes a new window to open.

A: You need to use an <IFRAME> and set its SRC property. For the same visual effect, you can make the <IFRAME> element's WIDTH and HEIGHT 100% to occupy the entire window.

Q: Jefferey Silverstone wants to put dashes in phone numbers and social security numbers, so the entire number is preserved—instead of being broken up in line wrapping. This would be similar to the way &nbsp; corresponds to fixed spaces.

A: Simple! Place the text inside a <NOBR></NOBR> tag pair.

Q: Josh Bell asks if there is a way to prevent the URL from being printed at the bottom of a page.

A: Programmatically, not unless you want to change the registry entries Non-MSDN Online link. With Internet Explorer 5.5, you can set the header, footer information using the new Print Templates. See http://msdn2.microsoft.com/en-us/library/aa753281.aspx.

Q: Tim Tabor is having trouble getting his HTML document to re-parse after inserting the <style> tag using insertAdjacentHTML.

A: Tim notified us that his solution was resolved with KB article Q185140 "PRB: Trouble Inserting Non-Displayable HTML into Web Page" Non-MSDN Online link.

Q: Woody wants to close the browser window with his own close button.

A: Examine the close method for details on how to do this and what to expect.

Q: Stephen Moras is having problems with cross-frame scripting.

A: Refer to KB article Q241754 "HOWTO: Create Cross-Frame Scripting-Capable Pages with HTML Apps" Non-MSDN Online link for possible solutions.

Rafael M. Muñoz, when not playing or coaching his favorite pastime (volleyball), provides technical assistance as a full-time developer support engineer for Microsoft Developer Support.

Thomas Moran, when not struggling to maintain some semblance of sanity (working with Rafael certainly doesn't help), toils with a prodigious team that creates articles and other content from Microsoft's Developer Support.

Kusuma Vellanki is one of the few people who like winters in Washington state more than summers. When not working as a Developer Support Engineer for the Internet Client team, she can be found torpedoing out of control down the ski slopes.