Creates "is_" variables indicating browser-specific attributes such as

  1. browser vendor:
         is_nav, is_ie, is_opera
  2. browser version number:
         is_major (integer indicating major version number: 2, 3, 4 ...)
         is_minor (float indicating full version number: 2.02, 3.01, 4.04 ...)
  3. browser vendor AND major version number:
         is_nav2, is_nav3, is_nav4, is_nav4up, is_nav5, is_nav5up, is_ie3, is_ie4, is_ie4up
  4. JavaScript version number:
         is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
  5. OS platform and version:
         is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98
         is_os2
         is_mac, is_mac68k, is_macppc
         is_unix
             is_sun, is_sun4, is_sun5, is_suni86
             is_irix, is_irix5, is_irix6
             is_hpux, is_hpux9, is_hpux10
             is_aix, is_aix1, is_aix2, is_aix3, is_aix4
             is_linux, is_sco, is_unixware, is_mpras, is_reliant
             is_dec, is_sinix, is_freebsd, is_bsd
         is_vms

This code was borrowed from Determining Browser Type and Version with JavaScript and WebReference.com to sniff out common browser environment variables useful for writing cross-browser scripts.

Remarks

Note: Netscape 6 now supports the W3C standards (DOM1 and some of DOM2), so it does not support the LAYER tag (and the popular "document.layers" test gives false) so many old DHTML scripts that depend on this test to determine if the client is running Netscape do not run. These scripts will have to be rewritten to use the DOM. You can use "document.getElementById" and is_nav (see below for test and short example code snippet) when testing for NS6+ and/or other DOM-compliant browsers.

Dependencies

n/a

Browser Attributes

Navigator Object Data

Version Number

Browser Version

JavaScript Version

OS

Object Detection Tests

Method Detection Tests

Screen Properties

Document Properties