/** * jQBrowser http://davecardwell.co.uk/geekery/javascript/jquery/jqbrowser/ * * @author Dave Cardwell * @version 0.1 * * @projectDescription Extend jQuery's browser detection capabilities. * * Built on the shoulders of giants: * * John Resig - http://jquery.com/ * * Peter-Paul Koch - http://www.quirksmode.org/?/js/detect.html * * * Copyright (c) 2006 Dave Cardwell, licensed under the MIT License: * * http://www.opensource.org/licenses/mit-license.php */ new function() { // Clear jQuery's native browser detection. $.browser = {}; for( var i = 0, // counter found = false, // browser detected? ua = navigator.userAgent, // the navigator's user agent ve = navigator.vendor, // the navigator's vendor data = [ // the browser data { // Safari identifier: 'safari', test: function() { return /Apple/.test(ve); } }, { // Opera identifier: 'opera', test: function() { return typeof window.opera != 'undefined'; } }, { // iCab identifier: 'icab', test: function() { return /iCab/.test(ua); } }, { // Konqueror identifier: 'konqueror', test: function() { return /KDE/.test(ve); } }, { // AOL Explorer identifier: 'aol', test: function() { return /America Online Browser/.test(ua); } }, { // Firefox identifier: 'firefox', test: function() { return /Firefox/.test(ua); } }, { // Flock identifier: 'flock', test: function() { return /Flock/.test(ua); } }, { // Camino identifier: 'camino', test: function() { return /Camino/.test(ua); } }, { // Netscape identifier: 'netscape', test: function() { return /Netscape/.test(ua); } }, { // Internet Explorer // identifier: 'msie', test: function() { return /MSIE/.test(ua); } }, { // Mozilla identifier: 'mozilla', test: function() { return /Gecko|Mozilla/.test(ua); } } ]; i < data.length; i++ ) { // Perform all of the checks until the current browser is found, then // set any remaining UAs to false. if( found || !data[i].test() ) { $.browser[data[i].identifier] = false; } else { $.browser[data[i].identifier] = found = true; } } }();