function testbrowser(the_object){ // Ultimate client-side JavaScript client sniff. Version 3.03 // (C) Netscape Communications 1999-2001. Permission granted to reuse and distribute. // Revised 17 May 99 to add this.nav5up and this.ie5up (see below). // Revised 20 Dec 00 to add this.gecko and change this.nav5up to this.nav6up // also added support for IE5.5 Opera4&5 HotJava3 AOLTV // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, // correct Opera 5 detection // add support for winME and win2k // synch with browser-type-oo.js // Revised 26 Mar 01 to correct Opera detection // Revised 02 Oct 01 to add IE6 detection // Everything you always wanted to know about your JavaScript client // but were afraid to ask. Creates "this." variables indicating: // (1) browser vendor: // this.nav, this.ie, this.opera, this.hotjava, this.webtv, this.TVNavigator, this.AOLTV // (2) browser version number: // this.major (integer indicating major version number: 2, 3, 4 ...) // this.minor (float indicating full version number: 2.02, 3.01, 4.04 ...) // (3) browser vendor AND major version number // this.nav2, this.nav3, this.nav4, this.nav4up, this.nav6, this.nav6up, this.gecko, this.ie3, // this.ie4, this.ie4up, this.ie5, this.ie5up, this.ie5_5, this.ie5_5up, this.ie6, this.ie6up, this.hotjava3, this.hotjava3up, // this.opera2, this.opera3, this.opera4, this.opera5, this.opera5up // (4) JavaScript version number: // this.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...) // (5) OS platform and version: // this.win, this.win16, this.win32, this.win31, this.win95, this.winnt, this.win98, this.winme, this.win2k // this.os2 // this.mac, this.mac68k, this.macppc // this.unix // this.sun, this.sun4, this.sun5, this.suni86 // this.irix, this.irix5, this.irix6 // this.hpux, this.hpux9, this.hpux10 // this.aix, this.aix1, this.aix2, this.aix3, this.aix4 // this.linux, this.sco, this.unixware, this.mpras, this.reliant // this.dec, this.sinix, this.freebsd, this.bsd // this.vms // // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html // for detailed lists of userAgent strings. // // Note: you don't want your Nav4 or IE4 code to "turn off" or // stop working when new versions of browsers are released, so // in conditional code forks, use this.ie5up ("IE 5.0 or greater") // this.opera5up ("Opera 5.0 or greater") instead of this.ie5 or this.opera5 // to check version in code which you want to work on future // versions. // convert all characters to lowercase to simplify testing var agt=navigator.userAgent.toLowerCase(); // *** BROWSER VERSION *** // Note: On IE5, these return 4, so use this.ie5up to detect IE5. //this.major= parseInt(navigator.appVersion); the_object["appVersion"]=navigator.appVersion the_object["userAgent"]=navigator.userAgent.toLowerCase(); the_object["platform"]=navigator.platform the_object["major"]= parseInt(navigator.appVersion); the_object["minor"] = parseFloat(navigator.appVersion); // Note: Opera and WebTV spoof Navigator. We do strict client detection. // If you want to allow spoofing, take out the tests for opera and webtv. the_object["nav"] = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); the_object["nav2"] = (the_object["nav"] && (the_object["major"] == 2)); the_object["nav3"] = (the_object["nav"] && (the_object["major"] == 3)); the_object["nav4"] = (the_object["nav"]&& (the_object["major"] == 4)); the_object["nav4up"] = (the_object["nav"] && (the_object["major"] >= 4)); the_object["navonly"] = (the_object["nav"] && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); the_object["nav6"] = (the_object["nav"] && (the_object["major"] == 5)); the_object["nav6up"] = (the_object["nav"] && (the_object["major"] >= 5)); the_object["gecko"] = (agt.indexOf('gecko') != -1); the_object["ie"] = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); the_object["ie3"] = (the_object["ie"] && (the_object["major"] < 4)); the_object["ie4"] = (the_object["ie"] && (the_object["major"] == 4) && (agt.indexOf("msie 4")!=-1) ); the_object["ie4up"] = (the_object["ie"] && (the_object["major"] >= 4)); the_object["ie5"] = (the_object["ie"] && (the_object["major"] == 4) && (agt.indexOf("msie 5.0")!=-1) ); the_object["ie5_5"] = (the_object["ie"] && (the_object["major"] == 4) && (agt.indexOf("msie 5.5") !=-1)); the_object["ie5up"] = (the_object["ie"] && !the_object["ie3"] && !the_object["ie4"]); the_object["ie5_5up"] =(the_object["ie"] && !the_object["ie3"] && !the_object["ie4"] && !the_object["ie5"]); the_object["ie6"] = (the_object["ie"] && (the_object["major"] == 4) && (agt.indexOf("msie 6.")!=-1) ); the_object["ie6up"] = (the_object["ie"] && !the_object["ie3"] && !the_object["ie4"] && !the_object["ie"] && !the_object["ie5_5"]); // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser // or if the_object is the first browser window opened. Thus the // variables the_object.aol, the_object.aol3, and the_object.aol4 aren't 100% reliable. the_object["aol"] = (agt.indexOf("aol") != -1); the_object["aol3"] = (the_object["aol"] && the_object["ie3"]); the_object["aol4"] = (the_object["aol"] && the_object["ie4"]); the_object["aol5"] = (agt.indexOf("aol 5") != -1); the_object["aol6"] = (agt.indexOf("aol 6") != -1); the_object["opera"] = (agt.indexOf("opera") != -1); the_object["opera2"] = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); the_object["opera3"] = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); the_object["opera4"] = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); the_object["opera5"] = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); the_object["opera5up"] = (the_object["opera"] && !the_object["opera2"] && !the_object["opera3"] && !the_object["opera4"]); the_object["webtv"] = (agt.indexOf("webtv") != -1); the_object["TVNavigator"] = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); the_object["AOLTV"] = the_object["TVNavigator"]; the_object["hotjava"] = (agt.indexOf("hotjava") != -1); the_object["hotjava3"] = (the_object["hotjava"] && (the_object["major"] == 3)); the_object["hotjava3up"] = (the_object["hotjava"] && (the_object["major"] >= 3)); // *** JAVASCRIPT VERSION CHECK *** if (the_object["nav2"] || the_object["ie3"]) the_object["js"] = 1.0; else if (the_object["nav3"]) the_object["js"] = 1.1; else if (the_object["opera5up"]) the_object["js"] = 1.3; else if (the_object["opera"]) the_object["js"] = 1.1; else if ((the_object["nav4"] && (the_object["minor"] <= 4.05)) || the_object["ie4"]) the_object["js"] = 1.2; else if ((the_object["nav4"] && (the_object["minor"] > 4.05)) || the_object["ie5"]) the_object["js"] = 1.3; else if (the_object["hotjava3up"]) the_object["js"] = 1.4; else if (the_object["nav6"] || the_object["gecko"]) the_object["js"] = 1.5; // NOTE: In the future, update the_object code when newer versions of JS // are released. For now, we try to provide some upward compatibility // so that future versions of Nav and IE will show they are at // *least* JS 1.x capable. Always check for JS version compatibility // with > or >=. else if (the_object["nav6up"]) the_object["js"]= 1.5; // NOTE: ie5up on mac is 1.4 else if (the_object["ie5up"]) the_object["js"] = 1.3 // HACK: no idea for other browsers; always check for JS version with > or >= else the_object["js"] = 0.0; // *** PLATFORM *** the_object["win"] = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all // Win32, so you can't distinguish between Win95 and WinNT. the_object["win95"] = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); // is the_object a 16 bit compiled version? the_object["win16"] = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) ); the_object["win31"] = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1)); the_object["winme"] = ((agt.indexOf("win 9x 4.90")!=-1)); the_object["win2k"] = ((agt.indexOf("windows nt 5.0")!=-1)); // NOTE: Reliable detection of Win98 may not be possible. It appears that: // - On Nav 4.x and before you'll get plain "Windows" in userAgent. // - On Mercury client, the 32-bit version will return "Win98", but // the 16-bit version running on Win98 will still return "Win95". the_object["win98"] = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); the_object["winnt"] = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); the_object["win32"] = (the_object["win95"] || the_object["winnt"] || the_object["win98"] || ((the_object["major"] >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); the_object["os2"] = ((agt.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1)); the_object["mac"] = (agt.indexOf("mac")!=-1); // hack ie5 js version for mac if (the_object["mac"] && the_object["ie5up"]) the_object["js"] = 1.4; the_object["mac68k"] = (the_object["mac"] && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1))); the_object["macppc"] = (the_object["mac"] && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1))); the_object["sun"] = (agt.indexOf("sunos")!=-1); the_object["sun4"] = (agt.indexOf("sunos 4")!=-1); the_object["sun5"] = (agt.indexOf("sunos 5")!=-1); the_object["suni86"]= (the_object["sun"] && (agt.indexOf("i86")!=-1)); the_object["irix"] = (agt.indexOf("irix") !=-1); // SGI the_object["irix5"] = (agt.indexOf("irix 5") !=-1); the_object["irix6"] = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1)); the_object["hpux"] = (agt.indexOf("hp-ux")!=-1); the_object["hpux9"] = (the_object["hpux"] && (agt.indexOf("09.")!=-1)); the_object["hpux10"]= (the_object["hpux"] && (agt.indexOf("10.")!=-1)); the_object["aix"] = (agt.indexOf("aix") !=-1); // IBM the_object["aix1"] = (agt.indexOf("aix 1") !=-1); the_object["aix2"] = (agt.indexOf("aix 2") !=-1); the_object["aix3"] = (agt.indexOf("aix 3") !=-1); the_object["aix4"] = (agt.indexOf("aix 4") !=-1); the_object["linux"] = (agt.indexOf("inux")!=-1); the_object["sco"] = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1); the_object["unixware"] = (agt.indexOf("unix_system_v")!=-1); the_object["mpras"] = (agt.indexOf("ncr")!=-1); the_object["reliant"] = (agt.indexOf("reliantunix")!=-1); the_object["dec"] = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); the_object["sinix"] = (agt.indexOf("sinix")!=-1); the_object["freebsd"] = (agt.indexOf("freebsd")!=-1); the_object["bsd"] = (agt.indexOf("bsd")!=-1); the_object["unix"] = ((agt.indexOf("x11")!=-1) || the_object["sun"] || the_object["irix"]|| the_object["hpux"] || the_object["sco"] ||the_object["unixware"] || the_object["mpras"] || the_object["reliant"] || the_object["dec"] || the_object["sinix"] || the_object["aix"] || the_object["linux"] || the_object["bsd"] || the_object["freebsd"]); the_object["vms"] = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1)); the_object["cookie_enabled"]=true }