(function (jQuery) {
if (jquery.browser) return;
jquery.browser = {};
JQuery.browser.mozilla = false;
JQuery.browser.webkit = false;
JQuery.browser.opera = false;
JQuery.browser.msie = false;
var nagt = navigator.useragent;
jQuery.browser.name = navigator.appname;
jQuery.browser.fullVersion = ' +parsefloat (navigator.appversion);
jQuery.browser.majorVersion = parseint (navigator.appversion,10);
var Nameoffset,veroffset,ix;
//In opera, the true version was after "Opera" or after "version"
if ((Veroffset=nagt.indexof ("Opera"))!=-1) {
JQuery.browser.opera = true;
jQuery.browser.name = "Opera";
jQuery.browser.fullVersion = nagt.substring (veroffset+6);
if ((Veroffset=nagt.indexof ("Version"))!=-1)
jQuery.browser.fullVersion = nagt.substring (veroffset+8);
}
//In MSIE, the true version was after ' MSIE ' in useragent
else if ((Veroffset=nagt.indexof ("MSIE"))!=-1) {
JQuery.browser.msie = true;
jQuery.browser.name = "Microsoft Internet Explorer";
jQuery.browser.fullVersion = nagt.substring (veroffset+5);
}
//In Chrome, the true version was after "Chrome"
else if ((Veroffset=nagt.indexof ("Chrome"))!=-1) {
JQuery.browser.webkit = true;
jQuery.browser.name = "Chrome";
jQuery.browser.fullVersion = nagt.substring (veroffset+7);
}
//In Safari, the true version was after "Safari" or after "version"
else if ((Veroffset=nagt.indexof ("Safari"))!=-1) {
JQuery.browser.webkit = true;
jQuery.browser.name = "Safari";
jQuery.browser.fullVersion = nagt.substring (veroffset+7);
if ((Veroffset=nagt.indexof ("Version"))!=-1)
jQuery.browser.fullVersion = nagt.substring (veroffset+8);
}
//In Firefox, the true version was after "Firefox"
else if ((Veroffset=nagt.indexof ("Firefox"))!=-1) {
JQuery.browser.mozilla = true;
jQuery.browser.name = "Firefox";
jQuery.browser.fullVersion = nagt.substring (veroffset+8);
}
//In the browsers, "Name/version" are at the end of the useragent
else if ((Nameoffset=nagt.lastindexof (') +1) <
(Veroffset=nagt.lastindexof ('/') ))
{
jQuery.browser.name = nagt.substring (nameoffset,veroffset);
jQuery.browser.fullVersion = nagt.substring (veroffset+1);
if (JQuery.browser.name.toLowerCase () ==jquery.browser.name.touppercase ()) {
jQuery.browser.name = navigator.appname;
}
}
//Trim the fullversion string at semicolon/space if present
if ((Ix=jquery.browser.fullversion.indexof (";"))! =-1)
jquery.browser.fullversion=jquery.browser.fullversion.substring (0,ix);
if ((Ix=jquery.browser.fullversion.indexof ("))!=-1)
jquery.browser.fullversion=jquery.browser.fullversion.substring (0,ix);
jQuery.browser.majorVersion = parseint ("+jquery.browser.fullversion,10");
if (IsNaN (jQuery.browser.majorVersion)) {
jQuery.browser.fullVersion = ' +parsefloat (navigator.appversion);
jQuery.browser.majorVersion = parseint (navigator.appversion,10);
}
jQuery.browser.version = jQuery.browser.majorVersion;
}) (JQuery);
Solutions to jquery that do not support $.browser