title: XMLHttpRequest based CORS call with Basic Auth fails in Firefox and Chrome
body: <p>Need to make a REST GET call with Basic Auth from a javascript (in www.domain1.com). REST API is in domain2.com. REST API returns with the CORS specific HTTP headers. I need to support IE, Chrome and Firefox. Below JavaScript explains the issue further –</p>
  
  <ol>
  <li><p>Without Basic Auth (WORKS in IE 10, Chrome and Firefox, taking care of Older IEs by XDomainRequest object)</p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open(method, url, true);
  </code></pre></li>
  <li><p>With Basic Auth (WORKS in IE 10 only, Fails in Chrome and Firefox)</p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open(method, url, true, username, password);
  </code></pre></li>
  <li><p>With Basic Auth (Fails in Chrome and Firefox)</p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open(method, url, true);
  xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
  xhr. withCredentials = “true”;
  </code></pre></li>
  <li><p>With Basic Auth (Fails in Chrome and Firefox)</p>
  
  <pre><code>$.ajax({
  type: 'GET',
  url: jsonp_url,
  dataType: "json",
  username: username,
  password: pwd,
  beforeSend: function (xhr) {xhr.withCredentials = true; },
  success: function (result) { },
  error: function (xhr, ajaxOptions, thrownError) {
  }
  </code></pre>
  
  <p>I would love to get a solution here that works in Chrome and FireFox with Basic Auth</p></li>
  </ol>