diff --git a/lib/http.js b/lib/http.js index c9689f0..d745e71 100644 --- a/lib/http.js +++ b/lib/http.js @@ -80,23 +80,27 @@ var HTTPObject = function(engine) { this.create = function() { switch (this.engine) { case "MSXML": - _interface = CreateObject([ - "Microsoft.XMLHTTP", - "WinHttp.WinHttpRequest.5.1", - "Msxml3.XMLHTTP", - "Msxml2.XMLHTTP", - "Msxml2.XMLHTTP.7.0", - "Msxml2.XMLHTTP.6.0", - "Msxml2.XMLHTTP.5.O", - "Msxml2.XMLHTTP.4.O", - "Msxml2.XMLHTTP.3.O", - "Msxml2.XMLHTTP.2.6", - "Msxml2.ServerXMLHTTP", - "Msxml2.ServerXMLHTTP.6.0", - "Msxml2.ServerXMLHTTP.5.0", - "Msxml2.ServerXMLHTTP.4.0", - "Msxml2.ServerXMLHTTP.3.0" - ]); + if (typeof XMLHttpRequest !== "undefined") { + _interface = new XMLHttpRequest(); + } else { + _interface = CreateObject([ + "Microsoft.XMLHTTP", + "WinHttp.WinHttpRequest.5.1", + "Msxml3.XMLHTTP", + "Msxml2.XMLHTTP", + "Msxml2.XMLHTTP.7.0", + "Msxml2.XMLHTTP.6.0", + "Msxml2.XMLHTTP.5.O", + "Msxml2.XMLHTTP.4.O", + "Msxml2.XMLHTTP.3.O", + "Msxml2.XMLHTTP.2.6", + "Msxml2.ServerXMLHTTP", + "Msxml2.ServerXMLHTTP.6.0", + "Msxml2.ServerXMLHTTP.5.0", + "Msxml2.ServerXMLHTTP.4.0", + "Msxml2.ServerXMLHTTP.3.0" + ]); + } break; case "CURL":