Detecting browsers that are not supported by jQuery (2)

后端 未结 2 835
星月不相逢
星月不相逢 2021-02-05 11:50

Forgive me if there is an obvious answer to this question, but I haven\'t been able to find it. I am considering switching over to jQuery 2 and, although I\'m not concerned abou

2条回答
  •  梦如初夏
    2021-02-05 12:10

    A way to get the benefits of jQuery 2.0 while supporting IE 6, 7 and 8, is to use conditional comments:

    
    
    
    
    • The first conditional comment ensures that jQuery 1.x is loaded for IE < 9.
    • The latest version of jQuery (2.0.3) is used in IE 9 and browsers where conditional comments are not recognized (IE 10 dropped support for conditional comments).
    • When jQuery fails to load from the CDN, a fallback (jquery.js, hosted on your server) is loaded.

提交回复
热议问题