home *** CD-ROM | disk | FTP | other *** search
/ Nintendo GameCube Preview CD-ROM / NINTENDOGAMECUBE.iso / site / js / browserdetect_lite.js next >
Text File  |  2001-08-30  |  2KB  |  46 lines

  1. // Browser Detect Lite  v1.0
  2. // http://www.dithered.com/javascript/browser_detect/index.html
  3. // modified by Chris Nott (chris@dithered.com)
  4.  
  5. function BrowserDetectLite() {
  6.     var agent = navigator.userAgent.toLowerCase(); 
  7.     
  8.     // Browser version
  9.     this.versionMajor = parseInt(navigator.appVersion); 
  10.     this.versionMinor = parseFloat(navigator.appVersion); 
  11.  
  12.     // Browser name
  13.     this.ns    = (agent.indexOf('mozilla')!=-1 && agent.indexOf('spoofer')==-1 && agent.indexOf('compatible') == -1 && agent.indexOf('opera')==-1 && agent.indexOf('webtv')==-1); 
  14.     this.ns2   = (this.ns && this.versionMajor == 2); 
  15.     this.ns3   = (this.ns && this.versionMajor == 3); 
  16.     this.ns4   = (this.ns && this.versionMajor == 4); 
  17.     this.ns4up = (this.ns && this.versionMajor >= 4); 
  18.     this.ns6   = (this.ns && this.versionMajor == 5); 
  19.     this.ns6up = (this.ns && this.versionMajor >= 5); 
  20.     this.ie    = (agent.indexOf("msie") != -1); 
  21.     this.ie3   = (this.ie && this.versionMajor < 4); 
  22.     this.ie4   = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 5") == -1); 
  23.     this.ie4up = (this.ie && this.versionMajor >= 4); 
  24.     this.ie5   = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 5.0") != -1); 
  25.     this.ie55 = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 5.5") != -1) 
  26.     this.ie5up = (this.ie  && !this.ie3 && !this.ie4); 
  27.     this.ie6 = (this.ie && this.versionMajor == 6);
  28.     this.ie6up = (this.ie && this.versionMajor >= 6);
  29.     this.opera = (agent.indexOf("opera") != -1); 
  30.     this.webtv = (agent.indexOf("webtv") != -1); 
  31.     this.aol = (agent.indexOf("aol") != -1); 
  32.     
  33.     // Javascript version
  34.     this.js = 0.0;
  35.     if (this.ns2 || this.ie3) this.js = 1.0 
  36.     else if (this.ns3 || this.opera || (document.images && this.ie && !this.ie4up)) this.js = 1.1 
  37.     else if ((this.ns4 && this.versionMinor <= 4.05) || this.ie4) this.js = 1.2 
  38.     else if ((this.ns4 && this.versionMinor > 4.05) || this.ie5up) this.js = 1.3 
  39.     else if (this.ns6up) this.js = 1.4 
  40.  
  41.     // Platform type
  42.     this.win   = (agent.indexOf("win")!=-1 || agent.indexOf("16bit")!=-1);
  43.     this.win32 = (agent.indexOf("win95")!=-1 || agent.indexOf("windows 95")!=-1 || agent.indexOf("win98")!=-1 || agent.indexOf("windows 98")!=-1 || agent.indexOf("winnt")!=-1 || agent.indexOf("windows nt")!=-1 || (this.versionMajor >= 4 && navigator.platform == "win32") || agent.indexOf("win32")!=-1 || agent.indexOf("32bit")!=-1);
  44.     this.mac   = (agent.indexOf("mac")!=-1);
  45. }
  46. var is = new BrowserDetectLite();