The New Year Cometh and the Web Men Goeth
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.
Rafael M. Munoz
January 1, 2001
Now's the time to say goodbye to all our family, W-E-B M-E-N. All right already, you probably get the hint. The Web Team's Web Men are moving on. Before we continue down the Web Men memory lane, let us first reassure you that the Web Team Talking column will continue. The Web Team has found two great replacements to work with Kusuma and Heidi as they continue the column into the future.
As we move on, we want to thank our family of readers for making us what we are. We know we have some true-blue, loyal readers who put aside The Washington Post and The Wall Street Journal to see what the Team has to say each month, and to you we say, "Thanks."
Be sure to check back in February when the new Team will begin its journey and continue our family traditions. Till then, we wanted to take this month to bring back some memories and show you where we, as developers, have come. Enjoy, and remember that things have changed over the years, so some questions and answers probably have better solutions today.
Thanks for the memories.
Rafael and Tom
Now, to infinity—and beyond!
Slick navigation: Building a drop-down list box—Originally published June 23, 1997
Are you asking us for a date?—Originally published May 3, 1999. Remember Y2K!
Haiku Contest: Remember when we asked for haiku?—Originally published June 7, 1999
Going back and forth—Disabling the browser's Forward/Back buttonsOriginally published July 3, 2000
Dear Web Men:
At the Site Builder Network home page, in the left-hand side, you have a selection criterion for International sites, under which you placed a drop-down menu. Usually, a drop-down menu is accompanied with a submit button. I want to know how to create the menu with a number of choices, without the submit button. When I select a choice, it must jump to the document linked using hyperlink, or otherwise. This document must appear in another frame, usually the frame used for displaying contents, the bigger one.
The Web Men reply:
Surprise, Raja! The Web Men are everywhere. Raja actually sent the above question to one of our favorite columnists, Mary Haggard, who promptly forwarded it us, knowing this was right up our alley.
When you check out the sample, you'll notice that—nothing up our sleeves—we have created a slick way of navigating our site without having to use a submit button with the drop-down list box.
Dear Web Men:
I have a date on a form that is entered in MM/DD/YY format. I would like to know how to change that to a 4-digit year.
The Web Men reply:
This is not as simple as it might appear, especially since you didn't provide a lot of background on what you are really trying to do. At first, we had written a nice little sample to show you how to convert your date, validate it, and present it for user verification. However, to quote the Genie in Disney's Aladdin: "There are a few, uh, provisos, ah, a couple a quid pro quos..." This is dangerous Y2K territory, and you need to show due diligence in understanding how to work with dates by visiting (and reading!) the link we give you below. Making a few assumptions about what you want to accomplish, the basic flow of what you need to do is this:
- Validate the date. Did the user enter a good date, or just some random numbers? Do this on the client side through script.
- Present it to the user as a four-digit date, both as a reminder to enter dates that way and to verify that the year is in the correct century. Date conversions make some intelligent guesses about what century a two-digit date is in, but depending on context, you may want to make sure.
- Validate the date again after giving the user the opportunity to verify it. After all, they might have changed it again.
- Store it properly. There are a variety of considerations here, depending on the technologies you are using and how you might later use the date. If you are going to use it for any sort of comparison, make sure you know exactly how it is stored, since sometimes time is stored as well and might lead to unexpected results.
- And don't mess with the regional settings and the short date style to get it to look right. That is not a good approach.
As we pointed out above, this can get fairly complex—in fact, there are hundreds of pages written on the subject on Microsoft's Y2K Web site. If this were an easy problem to solve, we wouldn't have bought that compound in Eastern Washington. Note, however, that we also purchased a solar collector, so that even in the face of the collapse of civilization, Web Men Talking will still be here to answer your questions.
We received far more entries than we had expected for our little haiku contest. Evidently, nearly everyone thought they could do better than we did. And you weren't too far off the mark. Here are our four favorites:
|Sweet Mother of God
You want me to write Haiku?
Get a %!##ing life!
Submitted by Dave Moyses
|People like Web sites
That have nice flashy graphics
But not me, too slow
Submitted by Chris Williams
|My ActiveX doc
Displaying in the browser.
Finally, it WORKS
Submitted by Dwayne Macadangdang
|"Make it cross-browser."
"The deadline is yesterday."
Oh death, where is thy sting?
Submitted by Jonathon Brownell
Haiku is generally considered to be 5-7-5 syllables, but that isn't a strict rule.
Dear Web Team:
Can anyone tell me if there is a way to disable the browser's Forward/Back buttons? The reason is that I can't allow the client to browse back to pages when they're on the Web site.
By disabling the Back button, I'd be okay—but so far, no luck on doing that. So I asked myself if I could delete the history list of the browser, and therefore block the back of the browser ... no can do either.
I have to find a way to catch the event back and redirect to the same page using VBScript.
The Web Team Replies:
Serge, we have answers galore to your question, and we've decided to hit you with everything we have! So brace yourself. Here they come.
There is no way to clear the session history through script, as you have found. Our mantra for most session-history questions like this is location.replace. Because you control all of the pages on your site, you can use location.replace to navigate from one page to another. This will replace the current history entry with the new page, so you always have only one entry from your site on the stack. Here's a snippet that shows how you can change your links to get this behavior.
This takes care of the Forward/Back problem. But this may not be the complete answer, depending on why you need this functionality. Is the main intention not to allow users to view the page again in that session? If so, you also have to prevent users from accessing this page by typing in the URL manually. Or is your intention to pull the page from the server each time, instead of from the cache, as would happen when the user clicks on the Forward/Back buttons?
The answer to the first question is pretty simple. You can use a session variable that is set when the user first requests a page, and the value of that variable will determine whether the user is allowed to access the page in the same session again.
The second question is a little more complicated. Internet Explorer 4.0 used the cache headers even when the user clicked on the Forward/Back buttons. Internet Explorer 5 complies with the HTTP specification, which states that when the user clicks on the Forward/Back buttons, the pages should be shown to the user exactly as they were viewed when they were saved in the history. In either case, you can still add HTTP headers to prevent the file from being cached on disk, which will force the browser to request it from the server. Refer to the Knowledge Base (KB) article Q234067 "HOWTO: Prevent Caching in Internet Explorer" for more information about these HTTP headers.
If the above solution does not work, you can leverage the session cookies' functionality to ensure that the page is always pulled from the server. To demonstrate, we've included some sample Active Server Pages (ASP) code.
Also, refer to the KB article Q199805 "PRB: Forward and Back Button Behavior in Internet Explorer" for more information regarding the Forward/Back button behavior in Internet Explorer.
Our very first:
Q: Justin Young asks how servers connect to the Internet.
A: Check Mary Haggard's second For Starters column, Get Your Server Here!.
Ah yes, something we still have to deal with—some things never change
Q: Nelson Emilio asks how to use Active Server Pages to show first-time visitors a special "first-time" page.
Tom's favorite shorts (You sure you want to look?)
Q: Deborah Rhoads wants to build a search engine.
Q: Sophia needs more documentation and samples for building a software update channel.
A: See the December 1997 Microsoft Internet Developer magazine feature Cutting Edge: Application Channel Format.
Don't forget the KB!
Q: Jaka is trying to insert a line break in the body of a message when using the mailto URL <A HREF="mailto:firstname.lastname@example.org?subject=Hello&body=line%20one%0D%0Anew%20line">Drop us a line</A>.
A: Escape the % in the carriage return and line feed characters to %25. Refer to Q251230 for more information.
Or the Workshop!
Q: Jaslyn wants to provide tooltips for individual items in a list box or drop-down list.