Back to Index Page


BROWSER DETECTION: objects

An alternative method of browser detection is to use the object support inherent in each browser. This strategy means determining whether a browser is aware of, and can work with, a specific type of object.

For instance, Netscape 4 used layers to provide dynamism and interactivity to pages. Because only Netscape 4 supports the document.layers object, an affirmative response to the document.layers object by definition indicates that Netscape 4.x is the browser in use.

Similarly, latest generation browsers now support the method document.getElementById(). This method, which enables the developer to direct activity toward an HTML element based on that element's ID attribute, is potentially very useful, but limited to IE 5.5, Netscape 6 and later. Thus, the developer must route users of earlier browsers to alternative content sources.

In both scenarios, it makes more sense to evaluate browser support for the objects and methods used by the page, rather than to evaluate by appName and appVersion, which may not accurately indicate functionality.


Print this Page || Browser Detection Using navigator