代码改变世界

检查是否ie6

2012-07-26 16:23  o-lijin-o  阅读(116)  评论(0编辑  收藏  举报

最简单的判断IE6的方法

    function isIE6()
    {
        if ( (!!window.ActiveXObject && !window.XMLHttpRequest) )
            return true;
        return false;       
    }

另外

if (window.XMLHttpRequest) {  
        //Firefox, Opera, IE7, and other browsers will use the native object  
        var request = new XMLHttpRequest();  
    } else {  
        //IE 5 and 6 will use the ActiveX control  
        var request = new ActiveXObject("Microsoft.XMLHTTP");  
    }  

来自以下网页

1 http://stackoverflow.com/questions/566303/detect-internet-explorer-6-or-below-in-jquery

2 https://developer.mozilla.org/en/DOM/XMLHttpRequest/Using_XMLHttpRequest_in_IE6