Variables from the sniffer script

The script incorporates a client sniffer, which returns a set of browser variables:

Underpinning these is a safety variable, for protecting legacy browsers:

There are also three OS variables:

and you can query a lower-case version of the user agent string:


The sniffer variables are global, and therefore available to any other scripts on the same page. They allow you to code for or exclude specific browers, eg:

Remember that some browsers return true for more than one variable:

The exclude variable returns true for all unspecified browsers. This is very useful for protecting them from scary DHTML, eg:

You may find it necessary to use a combination of expressions to get to the browser you need, eg:

But in many cases, old browsers can be excluded simply by using a version-specific tag, eg:

This method is not foolproof - Opera 3, for example, does have limited support for js1.2, so will read the script but likely make a mess of it. It's best to use a version-specific tag and the exclude variable, and test in all browsers you're concerned with. I admit I have a soft spot for Netscape 3 ... it reminds me of old rave music ...