How do I detect IE 8 with jQuery?

前端 未结 12 1406
一生所求
一生所求 2020-11-30 19:14

I need to detect not only the browser type but version as well using jQuery. Mostly I need to find out if it is IE 8 or not.

I am not sure if I am doing it correctly

12条回答
  •  借酒劲吻你
    2020-11-30 19:34

    I think the best way would be this:

    From HTML5 boilerplate:

    
    
    
      
    

    in JS:

    if( $("html").hasClass("ie8") ) { /* do your things */ };
    

    especially since $.browser has been removed from jQuery 1.9+.

提交回复
热议问题