The uaenvir.js help file

The functions in this file are controlled by Exami( ) in the accompanying script source file uaexami.js, on which they depend. This file uses expressions and a syntax, that will break script engines older than JavaScript language version 1.2 (Netscape and Internet Explorer, both versions 3 and earlier).

The navigator object

navigator.js
Completing the JavaScript language version check from ua.js, and setting the number value to 1.5 if appropriate.

The envir object

This script source file uses the functions Envir, Dom and Extra to set a number of properties for the envir, envir.dom and envir.extra objects.

Properties set by Envir(gen,vers)

This function is executed by the function Exami in the uaexami.js file.

The arguments:

gen
The browser generation as a number integer from navigator.appCodeNameSub, normally 4 (for DHTML browsers) or 5 (for W3C DOM standards and ECMAScript compliant browsers)
vers
This script code version, as for now the string v3.1.3

The primary properties:

envir.OS
This property equals the navigator.OS in the by now dated Practical Browser Sniffer.
  • win for all Windows platforms
  • mac for all Macintosh platforms
  • nix for all Unix like platforms
  • an empty string if platform is not one of the above
envir.java
boolean depending on whether java is installed and enabled.
envir.modern
boolean depending on whether java is enabled and compliance with the W3C DOM (level 1) and ECMAScript.
envir.ebusiness
boolean same as above, but also depending on whether cookies are enabled (which may be a prerequisite for online business).
envir.CSS1
number, which typically is 0, 0.3, 0.6, 0.8 or 1 depending on browser support of CSS version 1.
envir.CSS2
number, which typically is 0, 0.5, 1, 1.2, 1.4, 1.6, 1.8, 1.9, 2 or 2.1 depending on browser support of CSS version 2.
envir.language
Based on navigator.language, navigator.userLanguage or navigator.browserLanguage
  • language-code in the usual two-letter syntax (e.g. en for English)
  • an empty string if not reported by the browser
envir.dialect
As above, but also specifying the region by country (such as "en-GB" for British English).
  • language-code-country-code if the browser reports both (e.g. en-GB)
  • language-code if the country is not reported by the browser (e.g. en)
  • an empty string if not reported by the browser
envir.timezone
number corresponding to the timezone relative to GMT, e.g. 1 if in Western Europe. (This property is taking measures not to be confused by DST.)
envir.oldworld
boolean Old world timezones (from Cape Verde to Japan and Australia)
envir.newworld
boolean New world timezones (incl. the Pacific and Far Eastern parts of Russia)
envir.screencolor
Returns a number
  • 0 screen resolution is less than 256 colours
  • 1 screen resolution is 256 colours
  • 2 screen resolution is 16-bits (high) colour
  • 3 screen resolution is 24-bits colour
  • 4 screen resolution is 32-bits (true) colour
envir.screensize
Returns a number
  • 0 screen resolution is less than 640 x 480 pixels
  • 1 screen resolution is at least 640 x 480 pixels
  • 2 screen resolution is at least 800 x 600 pixels
  • 3 screen resolution is at least 1024 x 768 pixels
  • 4 screen resolution is at least 1152 x 864 pixels
  • 5 screen resolution is at least 1280 x 1024 pixels
  • 6 screen resolution is at least 1600 x 1200 pixels
envir.small
boolean depending on whether the screen resolution is set to 640 x 480 pixels or less.
envir.space
boolean depending on whether the screen resolution is set to at least 800 x 600 pixels and 256 colours.
envir.muchspace
boolean depending on whether the screen resolution is set to at least 1024 x 768 pixels and 16-bits (high) colour.
envir.dhtml
boolean depending on whether the browser is at least 4th generation (versions 4+) i.e. DHTML capable.
envir.common
boolean same as above, but also depending on whether the browser has CSS1 (fully) implemented.
envir.standards
boolean depending on whether the browser is at least 5th generation (versions 5+) i.e. W3C industry standards compliant.
envir.strict
boolean same as above, but also depending on whether the browser is to a great extent ready for XHTML and CSS2, and if it's implementing compatiblity mode.

The secondary properties:

envir.extra
object Creating this object while sending a number of arguments to Extra(arguments array) consisting of potential plug-ins mime types.
envir.dom
object Creating this object and conditionally setting one property:
envir.dom.implemented
Describing the occurrence of any W3C DOM compliance (cp. the next paragraph)
  • false if the gen argument (the general user agent version, i.e. the so-called browser generation) is less than 5.

Properties set by Dom( )

envir.dom.implemented
Describing the level of W3C DOM compliance reported by the browser
  • number corresponding to the level of the DOM: 0, 1, 2, or 3
envir.dom.html
  • false if not supported
  • true if HTML level 1
  • number corresponding to the level of HTML: 2
envir.dom.xml
  • false if not supported
  • true if XML level 1
  • number corresponding to the level of XML: 2 or 3
envir.dom.range
  • false if not supported
  • number corresponding to the level of Range: 2
envir.dom.traversal
  • false if not supported
  • number corresponding to the level of Traversal: 2
envir.dom.views
  • false if not supported
  • number corresponding to the level of Views: 2
envir.dom.stylesheets
  • false if not supported
  • number corresponding to the level of StyleSheets: 2
envir.dom.css
  • false if not supported
  • number corresponding to the level of CSS: 2
envir.dom.css2
  • false if not supported
  • number corresponding to the level of CSS2: 2
envir.dom.events
  • false if not supported
  • number corresponding to the level of Events: 2
envir.dom.uievents
  • false if not supported
  • number corresponding to the level of UIEvents: 2
envir.dom.mouseevents
  • false if not supported
  • number corresponding to the level of MouseEvents: 2
envir.dom.mutationevents
  • false if not supported
  • number corresponding to the level of MutationEvents: 2
envir.dom.htmlevents
  • false if not supported
  • number corresponding to the level of HTMLEvents: 2
envir.dom.ls
  • false if not supported
  • number corresponding to the level of LS: 3
envir.dom.lsasync
  • false if not supported
  • number corresponding to the level of LS-Async: 3
envir.dom.validation
  • false if not supported
  • number corresponding to the level of Validation: 3

Properties set by Extra(arguments array)

The arguments:

The arguments coming from the Envir function are any number of unmodified mime types strings, used by this function to check the availability of plug-ins for these mime types. To decide on the types checked, uaenvir.js must be edited. By default thirteen checks are made for demonstration purposes. They are not listed here. We should only look at Macromedia Flash for illustration.

The properties:

envir.extra.implemented
Describing the occurrence of any other envir.extra properties
  • boolean depending on whether the navigator.mimeTypes array are used by the browser and the type of navigator.javaEnabled is function.
envir.extra.java
Making a difference between Sun (or equivalent) and alternative java implementations
  • boolean depending on whether (Sun) java is enabled
  • undefined (or null) if another technology is applied; cp. envir.java above, in which case a boolean value is always returned
envir.extra.screensizecolor
Uses java's Abstract Window Toolkit to decide on the screen's color model
  • number of bits per pixel, typically 8, 16, 24 etc.
  • false if java is disabled
  • undefined (or null) if not applicable
envir.extra.screensizewidth
Uses java's Abstract Window Toolkit to decide on the screen's width
  • number of pixels, typically 640, 800, 1024 etc.
  • false if java is disabled
  • undefined (or null) if not applicable
envir.extra.screensizeheight
Uses java's Abstract Window Toolkit to decide on the screen's height
  • number of pixels, typically 480, 600, 768 etc.
  • false if java is disabled
  • undefined (or null) if not applicable
envir.extra.screenresolution
Uses java's Abstract Window Toolkit to decide on the screen's resolution
  • number of bits per pixel, e.g. 96
  • false if java is disabled
  • undefined (or null) if not applicable
envir.extra.application_x_shockwave_flash
Checking if the browser is prepared to harbour a plug-in for the particular mime type. Notice that "/" and "-" in the type description, transform into underscores in the property name.
  • boolean depending on whether application/x-shockwave-flash occurs in navigator.mimeTypes[ ]
  • undefined (or null) if not applicable
envir.extra.plugin_x_shockwave_flash
Checking if a plug-in is enabled for the particular mime type. Notice that the string before and including the "/" in the type description transforms into "plugin_" and that all "-" transform into underscores in the property name.
  • boolean depending on whether application/x-shockwave-flash returns true for navigator.mimeTypes[ ].enabledPlugin
  • undefined (or null) if not applicable

Valid HTML 3.2! © 2005 The Script is FREE TO BE USED (NOT TO BE TRADED IN) if author info is provided.