From: Dan Vanderkam <danvdk@gmail.com>
Date: Wed, 7 Aug 2013 02:15:00 +0000 (-0400)
Subject: make XHR work in IE6
X-Git-Tag: v1.0.0~9
X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=efc5160f320b94126829c939bd0a67fd15bcda6c;p=dygraphs.git

make XHR work in IE6
---

diff --git a/dygraph.js b/dygraph.js
index cc5f64b..994f7fb 100644
--- a/dygraph.js
+++ b/dygraph.js
@@ -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) {