Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

burst.web.UserAgent Class Reference

List of all members.

Detailed Description

Singleton class to provide identifying information about the current browser, and any bugs and features it may have.

The bu_UA global object is an instance of burst.web.UserAgent.

user agent identifiers

An instance has these member attributes which describe the browser:

family_
One of the BU_UA_FAMILY_* constants. This is indicates the ancestry of the source code of the browser. Thus Konqueror and Safari are in the same family, and Netscape and Mozilla are in the same family. But IE5-Mac is not in the same family as IE-Windows.

brand_
One of the BU_UA_BRAND_* constants. This indicates the associated brand name of the browser.

version_
A float giving the brand-specific release version (for example "1.2" might be a version for Mozilla).

generation_
This is an integer indicating the "generation". A fairly complete DOM, and the highest number currently set, is 5. That is also the minimum number we support. This "generation" matches ppk's definition of "version" at http://www.xs4all.nl/~ppk/js/browsers.html

os_
One of the BU_UA_OS_* constants.

For a good discussion, see http://www.xs4all.nl/~ppk/js/detect.html

A good list of useragent strings in the wild is http://www.xwolf.de/browserplaza/appnames.shtml An older larger list is: http://www.browserlist.browser.org/browser_mappings_list_big.html

For Netscape agent strings, see:

browser checks, object detection, and bug detection

You generally do not want to have explicit tests for particular browser makes/versions in your code, as you'll inevitably have false positives and false negatives, and future maintainers will not know what you are really testing for.

Object detection works in some cases, but not always: it is not sufficient for circumstances where objects or methods exist, but there are crippling defects in their implementation. For those cases, something more advanced is needed.

Ideally, we would have automatic "bug detection" when "object detection" is insufficient. This could be done as a sort of lazy "autoconf" that kicks in the first time a feature is queried for while running; thereafter the answer would be cached.

If it didn't have so many technology dependencies, some variant of the W3 DOM2 unit tests could be used ( http://www.w3.org/2002/11/DOM-Level-2-HTML-Results/ ).

Our own browser_bugs.html test page (in this release) has a few tests as well.

For now however, we hardcode the answers; we do not determine the correct answer at run time. That is, the implementation of functions like Boolean bug_iframe_display_none() returns an answer based on browser make and version.

user agent bugs and features

We distinguish between "bugs" and "features":

Generally speaking, a "bug" should be associated with a "less than or equal" test on particular browser brands and versions, indicating when it was fixed by.

A "feature" should be associated with a "greater than or equal" test on particular browser brands and versions, indicating when it started being available.

We have functions such as bug_iframe_display_none() for bugs, and can_iframe_onload_dyn() for features.


Public Member Functions

Boolean is_family_ie ()
 convenience for this.family_ == BU_UA_FAMILY_IE

Boolean bug_set_style_attribute ()
 true if the UA is unable to set the value of a 'style' attribute when the attribute name is a String.

Boolean bug_create_iframe ()
 true if the UA is unable to create an 'iframe' with document.createElement

Boolean bug_iframe_delayed_create ()
 true if a created iframe has no window until after a setTimeout or alert

Boolean bug_iframe_display_none ()
 true if the UA fails to process an iframe that has "display: none"

Boolean bug_iframe_relative_url ()
 true if the UA fails to treat links in a dynamically created iframe's contents relative to its parent (the src value of the iframe element, itself relativized to its window).

Boolean bug_ie_attributes ()
 true if Node.attributes is broken like ie.

Boolean can_iframe_onload_static ()
 True if the UA supports an onload attribute on an iframe element that is created through innerHTML or is statically already present in a document.

Boolean can_iframe_onload_dyn ()
 True if the UA supports an 'onload' attribute that is dynamically added to an iframe element through the DOM.


Static Public Attributes

final String BU_UA_FAMILY_IE = 'ie'
 IE, excluding IE5 Mac.

final String BU_UA_FAMILY_IEMAC = 'iemac'
 IE5 Mac.

final String BU_UA_FAMILY_OPERA = 'opera'
 Opera.

final String BU_UA_FAMILY_KHTML = 'khtml'
 Including konqueror, safari, atheos, and recent OmniWeb.

final String BU_UA_FAMILY_GECKO = 'gecko'
 Including mozilla, netscape.

final String BU_UA_FAMILY_ICAB = 'icab'
 icab.

final String BU_UA_FAMILY_ICE = 'ice'
 InFix acquired Wind River AS which acquired ICEStorm from norwegian icesoft.no .

final String BU_UA_FAMILY_W3M = 'w3m'
 See http://abe.nwr.jp/w3m/w3m-js-en.html for javascript.

final String BU_UA_FAMILY_UNKNOWN = 'unknown'
 There is a navigator object, but not one we understand.

final String BU_UA_FAMILY_NONE = 'none'
 There is not even a navigator object.

final String BU_UA_BRAND_KONQ = 'konqueror'
 'konqueror'

final String BU_UA_BRAND_SAFARI = 'safari'
 'safari'

final String BU_UA_BRAND_OPERA = 'opera'
 'opera'

final String BU_UA_BRAND_IE = 'ie'
 'ie'

final String BU_UA_BRAND_IEMAC = 'iemac'
 'iemac'

final String BU_UA_BRAND_NETSCAPE = 'netscape'
 'netscape'

final String BU_UA_BRAND_MOZILLA = 'mozilla'
 'mozilla'

final String BU_UA_BRAND_ICAB = 'icab'
 'icab'

final String BU_UA_BRAND_ICE = 'ice'
 'ice'

final String BU_UA_BRAND_W3M = 'w3m'
 'w3m'

final String BU_UA_BRAND_UNKNOWN = 'unknown'
 'unknown'

final String BU_UA_BRAND_NONE = 'none'
 'none'

final String BU_UA_OS_WIN = 'windows'
 'windows'

final String BU_UA_OS_MAC = 'mac'
 'mac'

final String BU_UA_OS_LINUX = 'linux'
 'linux'

final String BU_UA_OS_X11 = 'x11'
 'x11'

final String BU_UA_OS_UNKNOWN = 'unknown'
 'unknown'


Member Function Documentation

Boolean burst.web.UserAgent.bug_ie_attributes  ) 
 

true if Node.attributes is broken like ie.

See http://www.xs4all.nl/~ppk/js/w3c_core.html

Boolean burst.web.UserAgent.can_iframe_onload_dyn  ) 
 

True if the UA supports an 'onload' attribute that is dynamically added to an iframe element through the DOM.

The word "supports" here means that it would also need to be called after any dynamic location.replace. Also, the value set to the attribute is a Function, not a String.

Boolean burst.web.UserAgent.can_iframe_onload_static  ) 
 

True if the UA supports an onload attribute on an iframe element that is created through innerHTML or is statically already present in a document.

W3 says nothing at all about an onload attribute for iframe or frame, only frameset: http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5


Member Data Documentation

final String burst.web.UserAgent.BU_UA_FAMILY_ICE = 'ice' [static]
 

InFix acquired Wind River AS which acquired ICEStorm from norwegian icesoft.no .

Uses Mozilla Rhino for javascript.

final String burst.web.UserAgent.BU_UA_FAMILY_OPERA = 'opera' [static]
 

Opera.

FYI, they call their engine "Presto"


The documentation for this class was generated from the following file:
Generated on Tue Nov 30 04:03:09 2004 for BurstProject by doxygen 1.3.4