A Frustrated Dude!

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.

David Massy
Microsoft Corporation

November 27, 2000

Contents

I'm Frustrated
Using the New Stuff
Sniffing the Browser
Downgradable Content
It's Better to Behave
Ending Frustration

After standing in as guest columnist for the DHTML Dude last month I have agreed to assume this role full time, taking over responsibility from Michael Wallent, who has written this column since October 1997. To kick off the "new" DHTML Dude column, I thought I'd discuss some of the frustrations developers face.

I'm Frustrated

As I type this, I'm sitting in a fog-bound airport in Illinois waiting for a bus to take me to Chicago to replace a canceled flight. Naturally I'm frustrated, along with many of the passengers around me, because it is unclear when I'll finally get home.

But I'm not going to write about the frustrations of air travel. Instead I thought I'd discuss the frustration that I and others feel as we try to move the Web forward and offer users a more interactive experience through DHTML technologies. During the conference I just attended on MathML, which I hope to discuss in a future column, I once again encountered people who are frustrated because they have amazing technology to help solve real problems, but they're restricted from fully using it because many people are still using older browsers.

If you publish content for the Web, you usually want as many people as possible to be able to access it from the widest possible range of devices. This restricts you from using some of the newer technologies available because it is often unrealistic to tell people that they must upgrade their browsers to read the content. As someone who is closely involved with delivering powerful DHTML technologies in Microsoft® Internet Explorer, I'm frustrated when people say, "This is great and amazing, but I can't use it."

Using the New Stuff

You can use the newer DHTML technologies on a Web site in a number of ways that require differing degrees of effort. Before we explore DHTML behaviors, let's first look at a common technique as a way to add dynamic functionality more easily, though it won't give you quite the same amount of flexibility.

Sniffing the Browser

One way to make use of newer technologies is to sniff the browser type and version, then serve up appropriate content for the browser concerned. This is undoubtedly the best option because it allows the server, for example, to send rich DHTML content when appropriate, rather than the static HTML 3.2 content an older browser would receive.

In some ways, this option is best because it allows you to fully use the DHTML functionality of an up-to-date browser without compromise. However, it does require you to author the same content multiple times for the different browsers you wish to support. For many types of content this adds unreasonable expense, particularly when a site's content changes frequently.

Downgradable Content

If browser sniffing is something you don't feel able to adopt due to the expense involved in authoring multiple versions of the same content, there is an alternative that I like to refer to as downgradable content.

The idea here is to use DHTML behaviors to add dynamic functionality to a page so that the HTML content will look fine in an older browser and will be more interactive for a user with an up-to-date browser.

Let's explore an example behavior that adds expanding and collapsing functionality to HTML lists for a more interactive user experience, but still has the same HTML content viewable on an older browser. First, let's look at the content without the behaviors.

As you can see, this is just a simple, unordered HTML list with nesting. Now let's add a couple of behaviors to the same content and see how they make the list more interactive.

Here you can see the same content, but now icons show the expanded content. If you click the open folder icons, the content will expand or collapse. If you use a browser other than Internet Explorer 5.0 or later, you will see the same rendering shown in the first example above. The behaviors are simply declared as styles for the <UL> and <LI> tags, using a cascading style sheet so that Internet Explorer utilizes the behaviors where they add functionality to the page.

I'm not going to detail how these behaviors work this time around. I instead want to stress how easy it is to use behaviors rather than how they are written. The tree.htc and node.htc files are there for you to examine if you are interested (view in any text editor). If you would like me to discuss the details in a later column, let me know.

Such interactivity is easily achieved and, using behaviors in this way can give your users a more enjoyable and pleasant experience. It can help boost return visits to your site because users have a pleasant, interactive experience, as opposed to the static displays of other sites.

It's Better to Behave

It is, of course, very true that this same effect can be achieved without behaviors by adding script to the page. However, behaviors offer some distinct advantages over adding script.

To understand these advantages, let's consider how much effort would be involved in adding the script to a page. Even if the script were prewritten and available in a linked script file, we would still need to add a script tag to the page and have it apply this functionality to the particular list we wish to expand and collapse.

I should mention here that many Web authors are quite uncomfortable placing script on their pages because they do not consider themselves programmers. While I'm sure most of the people reading this column are familiar with programming in script and consider it to be relatively easy to program something such as an expandable/collapsible list, designers and authors of content may not be. They are happy to use HTML and CSS to produce attractive documents, but they often struggle when they see script tags in their documents. When a content author doesn't understand what is happening with script on a page, he or she can easily break that script when updating content.

Let's also consider the situation where the Web-page author wishes to have two separate, expandable/collapsible lists in the document. Now they must change the script to control two separate lists on the page.

Let's compare this with the requirements to use a behavior to add this functionality to a page. Page authors need know nothing about script to add as many expanding and collapsing lists to pages as they like by simply using the behavior property in CSS. The behavior can be supplied by a programmer who produces a simple set of reusable components that non-programmers can use to make their pages more interactive.

Ending Frustration

I hope this information helps cure your frustration about using new browser technologies. Now that the bus has arrived for the three-hour ride to the airport, I'm no longer as frustrated as when I started this column. Of course, the real resolution to developers' frustration is to encourage everyone to upgrade to an up-to-date browser so that we can implement some of these exciting technologies and make our users' lives more pleasant.

One final note: Not only was my plane delayed and then cancelled, but my luggage was lost as well.

 

DHTML Dude

David Massy works on Internet Explorer as a program manager.


  
Show: