title: XMLHTTPRequest ReadyState issue in IE
body: <p>From my UI thread, I am trying to start a worker thread to do XMLHTTPRequest. It works perfectly in Chrome, but in IE 10 its not working.
  In IE its always giving me ReadyState =1, Status=0 and stopping. In chrome the code works perfectly and as expected. Can anybody advise me please what might be wrong here related to one browser?</p>
  
  <p>UI thread code:</p>
  
  <pre><code>  if (typeof (Worker) !== "undefined") {
              var w = new Worker("worker.js");
              var now = new Date();
              w.postMessage({
                  newid: ws.length,
                  starttime: now
              });
  </code></pre>
  
  <p>Below is my worker.js code</p>
  
  <pre><code>this.onmessage = function ($event) {
  var myid = 0;
  var mystarttime = "";
  var url = "http://rest-service.guides.spring.io/greeting";
  
  myid = $event.data.newid;
  mystarttime = $event.data.starttime;
  
  var gotresponse = function () {
      var rs = new Response();
      if ((xhr.readyState == 4 || xhr.readyState == 3) &amp;&amp; xhr.status == 200) {
          var result = JSON.parse(xhr.responseText);
          rs.id = myid;
          rs.starttime = mystarttime;
          rs.data = result.content;
          rs.endtime = new Date();
      }
      else {
          rs.err = 'Error.   ReadyState: ' + xhr.readyState + ' Status:' + xhr.status;
      }
      self.postMessage(rs);
      self.close();
  };
  
  var timedout = function () {
      var rs = new Response();
      rs.err = 'Error TIMEOUT occurred : ' + xhr.statusText + '  ReadyState: ' + xhr.readyState + ' Status:' + xhr.status + ' E: ' + e + ' Msg:' + e.message;
      rs.starttime = mystarttime;
      rs.data = result.content;
      rs.endtime = new Date();
  
  
      self.postMessage(rs);
      self.close();
  };
  
  function Response(name, gender) {
      this.id = 0;
      this.data = "";
      this.starttime = new Date();
      this.endtime = new Date();
      this.err = "";
  }
  
  var xhr = new XMLHttpRequest();
  getSpecData();
  
  function getSpecData() {
      try {
          xhr.onload = function () { console.log(this.responseText); };
          xhr.open('GET', url, false);
          xhr.timeout = 5000;
          xhr.setRequestHeader('Content-Type', 'application/json');
          //xhr.setRequestHeader('Authorization', 'Basic ' + btoa('sk:pwd'));
          xhr.ontimeout = timedout;
          xhr.onreadystatechange = gotresponse;
          //xhr.withCredentials = true;
          xhr.send();
      } catch (e) {
          var rs = new Response();
          rs.err = 'Error occured : ' + xhr.statusText + '  ReadyState: ' + xhr.readyState + ' Status:' + xhr.status + ' E: ' + e + ' Msg:' + e.message;
          self.postMessage(rs);
          self.close();
      }
  }
  </code></pre>
  
  <p>};  </p>