Browser detection with JQuery

Want to determine the browser version for conditional Javascript/JQuery ? Use JQuery then.


if( $.browser.safari ) {
    //Safari
} elseif ($.browser.msie && $.browser.version > 6 ) {
    //IE v7+
} else if ($.browser.msie && $.browser.version <= 6 ) {
    //IE  -v7
} elseif ($.browser.mozilla && $.browser.version >= "1.8" ) {
    //FF2+
}