spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column77


Netscape 6, Part VI: Object-Oriented DOCJSLIB 1.2

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

browserSniffer.js

function browserSniffer() {
  this.ie4 = document.all && !document.getElementById;
  this.ns4 = document.layers;
  this.ie5 = document.all && document.getElementById;
  this.ns6 = document.getElementById && !document.all;
}

In future versions of DOCJSLIB, we plan to load only the relevant API instead of all four. The file would look like this:

function browserSniffer() {
  this.ie4 = document.all && !document.getElementById;
  this.ns4 = document.layers;
  this.ie5 = document.all && document.getElementById;
  this.ns6 = document.getElementById && !document.all;
  if (this.ie4) document.write('<SCRIPT LANGUAGE="JavaScript" 
                                 SRC="docjslibIE4SubClass.js"></SCRIPT>')
  else if (this.ie5) document.write('<SCRIPT LANGUAGE="JavaScript" 
                                 SRC="docjslibIE5SubClass.js"></SCRIPT>')
  else if (this.ns4) document.write('<SCRIPT LANGUAGE="JavaScript" 
                                 SRC="docjslibNS4SubClass.js"></SCRIPT>')
  else if (this.ns6) document.write('<SCRIPT LANGUAGE="JavaScript" 
                                 SRC="docjslibNS6SubClass.js"></SCRIPT>')			 
}

Next: Creating a browser-dependent subclass on the fly

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: February 12, 2001
Revised: February 12, 2001

URL: http://www.webreference.com/js/column77/11.html