Browser detection In jQuery 1.9.0

Browser detection via $.browser was depracated before and it was officially removed from the latest jQuery release (1.9.0). Personally I didn’t know this until a jQuery plugin throw error message.

The reason for removal is that jQuery author opposes the idea of browser detection via user agent, instead he suggests feature detection via Modernizr . If for some reason you still need browser property then you can do a quick regex test to user agent.

if (!jQuery.browser) {
    var userAgent = navigator.userAgent.toLowerCase();
    jQuery.browser = {};
    jQuery.browser.msie = /msie/.test(userAgent);
    jQuery.browser.mozilla = /mozilla/.test(userAgent) && !/webkit/.test(userAgent);
    jQuery.browser.webkit = /webkit/.test(userAgent);
    jQuery.browser.opera = /opera/.test(userAgent);
}

Alternatively you can use jQuery Migrate plugin