Page is a not externally linkable
rewboss - 9:03 pm on Jul 16, 2002 (gmt 0)
if(document.all){ People who checked for "Netscape" found their DHTML scripts broke when NS6 was launched. Sometimes, though, you can fall foul of browser quirks. For example, many preload scripts start with if(document.images), which only attempts to create Image objects and download the files if the images[] array is present. Very sensible; unfortunately, in many browsers, the images[] array is not actually available to JavaScript until the entire document has finished downloading and often even not until the onload handler has returned, so the preload script never executes. Occasionally, there are features you know are only implemented on certain specific browsers, or bugs you want to work around. If you happen to know exactly what browsers you need to target, and can be sure you don't want to target any others, checking the navigator object may be appropriate.
Generally speaking, you want to check for features -- this has always been the way to do it. The classic example is:
// Code for W3C-compliant browsers
}
if(document.layers){
// Code for NS4
}