make XHR work in IE6
authorDan Vanderkam <danvdk@gmail.com>
Wed, 7 Aug 2013 02:15:00 +0000 (22:15 -0400)
committerDan Vanderkam <danvdk@gmail.com>
Wed, 7 Aug 2013 02:15:00 +0000 (22:15 -0400)
dygraph.js

index cc5f64b..994f7fb 100644 (file)
@@ -3542,7 +3542,16 @@ Dygraph.prototype.start_ = function() {
     if (line_delimiter) {
       this.loadedEvent_(data);
     } else {
-      var req = new XMLHttpRequest();
+      // REMOVE_FOR_IE
+      var req;
+      if (window.XMLHttpRequest) {
+        // Firefox, Opera, IE7, and other browsers will use the native object
+        req = new XMLHttpRequest();
+      } else {
+        // IE 5 and 6 will use the ActiveX control
+        req = new ActiveXObject("Microsoft.XMLHTTP");
+      }
+
       var caller = this;
       req.onreadystatechange = function () {
         if (req.readyState == 4) {