Detect Internet Explorer 6 or below in jQuery

前端 未结 13 2464
野的像风
野的像风 2020-12-12 17:44

I\'m new to jquery and was wondering: is a simple way to detect whether a browser is Internet Explorer 6 or below?

13条回答
  •  萌比男神i
    2020-12-12 18:21

    If ActiveXObject exists and XMLHttpRequest does not, it's IE6:

    /* IE6 Check */
    (!!window.ActiveXObject && !window.XMLHttpRequest) ? true : false;
    

    In IE7, it would be:

    (!!window.ActiveXObject && !!window.XMLHttpRequest) ? true: false;
    

    References

    • JavaScriptKit: AJAX

提交回复
热议问题