BrowserCheck Object

With the advent of new browsers I needed a more sohpisticated browser checking solution - the document.layers and document.all check that I've been using will not suffice when we need to work with Netscape 4.0, 5.0 and Internet Explorer 4.0 and 5.0. We need a way to individually check for them. So I've built the BrowserCheck Object. This object is including within the DynLayer, and as well as a separate js file if you want to use it when you're not using the DynLayer.

This object will automatically define an instance of itself as "is":

is = new BrowserCheck()

The is object has the following properties

This combination of properties will serve almost all your needs with respect to DHTML - that's all this object is designed to do. You could extend this to check for operating systems and mime-plugins or whatever.

So now you no longer need the following lines on any pages:

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

Instead add the browser.js file to your page:

<script language="JavaScript" src="../dynapi/browsercheck.js"></script>

Or, if you are already using the DynLayer you don't need to do anything. The DynLayer has the BrowserCheck Object in its source.

View browsercheck.html for an example showing the output of the BrowserCheck Object on your browser. View Source Code

Source Code

Download: browsercheck.js
View Source: browsercheck.js

Home Next Lesson: Dynamic Layer Object API
copyright 1998 Dan Steinman

Casa de Bender