兼容jq版本判断浏览器?

Others 2018-06-08 08:58:19 2018-06-08 08:58:19 2309 次浏览

var userAgent = navigator.userAgent.toLowerCase();
    // Figure out what browser is being used 
    jQuery.browser = {
        version: (userAgent.match(/.+(?:rv|it|ra|ie)/: /) || [])[1],
        safari: /webkit/.test(userAgent),
        opera: /opera/.test(userAgent),
        msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
        mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
    };