browser.msie error after update to jQuery 1.9.1

前端 未结 11 1920
别那么骄傲
别那么骄傲 2020-11-27 03:32

I use the following snip of a script:

if ($.browser.msie && $.browser.version < 9) {
   extra = \"?\" + Math.floor(Math.random() * 3000);
}
         


        
11条回答
  •  臣服心动
    2020-11-27 04:07

    Update! Complete answer overhaul for new plugin!

    The following plugin has been tested in all major browsers. It makes traditional use of userAgent string to re-equip jQuery.browser only if you're using jQuery version 1.9 or Greater!

    It has the traditional jQuery.browser.msie type properties as well as a few new ones, including a .mobile property to help decide if user is on a mobile device.

    Note: This is not a suitable replacement for feature testing. If you expect to support a specific feature on a specific device, it's still best to use traditional feature testing

    /**	jQuery.browser
     *	@author	J.D. McKinstry (2014)
     *	@description	Made to replicate older jQuery.browser command in jQuery versions 1.9+
     *	@see http://jsfiddle.net/SpYk3/wsqfbe4s/
     *
     *	@extends	jQuery
     *	@namespace	jQuery.browser
     *	@example	jQuery.browser.browser == 'browserNameInLowerCase'
     *	@example	jQuery.browser.version
     *	@example	jQuery.browser.mobile	@returns	BOOLEAN
     *	@example	jQuery.browser['browserNameInLowerCase']
     *	@example	jQuery.browser.chrome	@returns	BOOLEAN
     *	@example	jQuery.browser.safari	@returns	BOOLEAN
     *	@example	jQuery.browser.opera	@returns	BOOLEAN
     *	@example	jQuery.browser.msie	@returns	BOOLEAN
     *	@example	jQuery.browser.mozilla	@returns	BOOLEAN
     *	@example	jQuery.browser.webkit	@returns	BOOLEAN
     *	@example	jQuery.browser.ua	@returns	navigator.userAgent String
     */
    ;;(function($){var a=$.fn.jquery.split("."),b;for(b in a)a[b]=parseInt(a[b]);if(!$.browser&&(1').append(
                $('', { text: x }),
                $('', { text: b[x] })
            ).appendTo($('table'));
    }
    table { border-collapse: collapse; }
    th, td { border: 1px solid; padding: .25em .5em; vertical-align: top; }
    th { text-align: right; }
    
    textarea { height: 500px; width: 100%; }
    
    

提交回复
热议问题