jquery.extend({ browser: function() { var rwebkit = /(webkit)\/([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, browser = {}, ua = window.navigator.useragent, browsermatch = uamatch(ua,rwebkit,ropera,rmsie,rmozilla); if (browsermatch.browser) { browser[browsermatch.browser] = true; browser.msie = browsermatch.browser; browser.version = browsermatch.version; } return { browser: browser }; } }); function uamatch(ua,rwebkit,ropera,rmsie,rmozilla) { ua = ua.tolowercase(); var match = rwebkit.exec(ua) || ropera.exec(ua) || rmsie.exec(ua) || ua.indexof("compatible") < 0 && rmozilla.exec(ua) || []; return { browser : match[1] || "", version : match[2] || "0" }; }