[jQuery] IE7 and XmlHttpRequest: check native first instead of ActiveX

[jQuery] IE7 and XmlHttpRequest: check native first instead of ActiveX


Hi all,
the following lines lead to IE7 using the XmlHttpRequest object as
ActiveX object and not as native JavaScript object (even if it's not
sooo native):
// If IE is used, create a wrapper for the XMLHttpRequest object
if ( jQuery.browser.msie )
    XMLHttpRequest = function(){
        return new ActiveXObject(
            navigator.userAgent.indexOf("MSIE 5") >= 0 ?
            "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
        );
    };
Related: http://ajaxian.com/archives/ajax-on-ie-7-check-native-first
I think it would be better to avoid ActiveX in IE7 and use object
detection like the following, besides that Opera can disguise itself
completely as IE
(http://webstandardsgroup.org/features/david-storey.cfm, see question 9):
// If IE is used, create a wrapper for the XMLHttpRequest object
if ( !XMLHttpRequest && ActiveXObject )
    XMLHttpRequest = function(){
        return new ActiveXObject(
            navigator.userAgent.indexOf("MSIE 5") >= 0 ?
            "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
        );
    };
-- Klaus
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/