1// Browser Detect Lite v2.1.4 2// http://www.dithered.com/javascript/browser_detect/index.html 3// modified by Chris Nott ([email protected] - remove NOSPAM) 4 5 6function BrowserDetectLite() { 7 var ua = navigator.userAgent.toLowerCase(); 8 9 // browser name 10 this.isGecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1); 11 this.isMozilla = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length); 12 this.isNS = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) ); 13 this.isIE = ( (ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) ); 14 this.isSafari = (ua.indexOf('safari') != - 1); 15 this.isOpera = (ua.indexOf('opera') != -1); 16 this.isKonqueror = (ua.indexOf('konqueror') != -1 && !this.isSafari); 17 this.isIcab = (ua.indexOf('icab') != -1); 18 this.isAol = (ua.indexOf('aol') != -1); 19 20 // spoofing and compatible browsers 21 this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE); 22 this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla); 23 24 // browser version 25 this.versionMinor = parseFloat(navigator.appVersion); 26 27 // correct version number 28 if (this.isNS && this.isGecko) { 29 this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) ); 30 } 31 else if (this.isIE && this.versionMinor >= 4) { 32 this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) ); 33 } 34 else if (this.isMozilla) { 35 this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ); 36 } 37 else if (this.isSafari) { 38 this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) ); 39 } 40 else if (this.isOpera) { 41 if (ua.indexOf('opera/') != -1) { 42 this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) ); 43 } 44 else { 45 this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) ); 46 } 47 } 48 else if (this.isKonqueror) { 49 this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) ); 50 } 51 else if (this.isIcab) { 52 if (ua.indexOf('icab/') != -1) { 53 this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) ); 54 } 55 else { 56 this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) ); 57 } 58 } 59 60 this.versionMajor = parseInt(this.versionMinor); 61 this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 ); 62 63 // dom support 64 this.isDOM1 = (document.getElementById); 65 this.isDOM2Event = (document.addEventListener && document.removeEventListener); 66 67 // css compatibility mode 68 this.mode = document.compatMode ? document.compatMode : 'BackCompat'; 69 70 // platform 71 this.isWin = (ua.indexOf('win') != -1); 72 this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) ); 73 this.isMac = (ua.indexOf('mac') != -1); 74 this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1) 75 this.isLinux = (ua.indexOf('linux') != -1); 76 77 // specific browser shortcuts 78 this.isNS4x = (this.isNS && this.versionMajor == 4); 79 this.isNS40x = (this.isNS4x && this.versionMinor < 4.5); 80 this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7); 81 this.isNS4up = (this.isNS && this.versionMinor >= 4); 82 this.isNS6x = (this.isNS && this.versionMajor == 6); 83 this.isNS6up = (this.isNS && this.versionMajor >= 6); 84 this.isNS7x = (this.isNS && this.versionMajor == 7); 85 this.isNS7up = (this.isNS && this.versionMajor >= 7); 86 87 this.isIE4x = (this.isIE && this.versionMajor == 4); 88 this.isIE4up = (this.isIE && this.versionMajor >= 4); 89 this.isIE5x = (this.isIE && this.versionMajor == 5); 90 this.isIE55 = (this.isIE && this.versionMinor == 5.5); 91 this.isIE5up = (this.isIE && this.versionMajor >= 5); 92 this.isIE6x = (this.isIE && this.versionMajor == 6); 93 this.isIE6up = (this.isIE && this.versionMajor >= 6); 94 95 this.isIE4xMac = (this.isIE4x && this.isMac); 96} 97var browser = new BrowserDetectLite();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.