/* * Detect browser version * * Copyright (c) 2004, Mackley F. Pexton. All rights reserved. */ /** The following constants are true or false depending upont the browser. These are class constants, an object does NOT have to be instantiated first before using. Example: if (bv.isNS) do_something(); To test which browser flags are set, simply type: javascript:bv(); into the address bar of your browser. **/ bv.isNS = (navigator.userAgent.indexOf("Netscape") >= 0) ? true : false; bv.isNS71 = (navigator.userAgent.indexOf("Netscape/7.1") >= 0) ? true : false; bv.isOpr = (navigator.userAgent.indexOf("Opera") >= 0) ? true : false; bv.isOpr5 = (navigator.userAgent.search(/Opera.5/) >= 0) ? true : false; bv.isOpr6 = (navigator.userAgent.search(/Opera.6/) >= 0) ? true : false; bv.isOpr7 = (navigator.userAgent.search(/Opera.7/) >= 0) ? true : false; bv.isSafari = (navigator.userAgent.search(/Safari/) >= 0) ? true : false; bv.isKonq = (navigator.vendor == "KDE") ? true : false; bv.isIE = (document.all && ! bv.isOpr && ! bv.isKonq); bv.isIE6 = (bv.isIE && document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false; bv.isIE5Mac = (bv.isIE && navigator.userAgent.indexOf('Mac') >= 0) ? true : false; bv.isIE5 = (bv.isIE && ! bv.isIE5Mac && ! bv.isIE6) ? true : false; // default version bv.isMoz = (! bv.isNS && ! bv.isOpr && ! bv.isIE && ! bv.isSafari && ! bv.isKonq && navigator.userAgent.indexOf("Mozilla") == 0) ? true : false; function bv() { // Return all the browser version flags that match this browser. var v,s = ""; for (v in bv) if (v.substring(0,2) == "is" && bv[v]) s += (s ? " " : "") + v; return s; } // Uncomment the following if you have a non-menu page for old browsers. //if (! bv()) location.href = "http://www.your-web-site.com/user-message.html";