This page works in any JavaScript-enabled browser. If you're using Internet Explorer 4.0 or later, you'll see a digital clock ticking away above this text. If you're using any other browser, you'll see a static image and some text instead. The page decides for itself whether to execute the IE4-specific JavaScript code which displays and updates the clock, so you don't need to protect it behind a switching page (see previous example).
Programming browser-specific code is quite simple. First I execute my version-checking routine (see source code) when the page is opened. This places a true or false value in the variable 'RunningIE4'. I can then protect all IE-specific code like this:
if (RunningIE4 == true) {
IE4-specific code
} else {
alternative code for non-IE4 browsers
}
Incidentally, my clock routine (a modified version of an example from Microsoft's Internet Client SDK) uses the window.setInterval method to set an timer which updates the display at specified intervals (once a second in this case). There's more on Interval timers in this month's Animation examples.