title: download file from google drive using javascript
body: <p>I searched many places however no luck to find a help.</p>
  
  <p>I want to use javascript to download file from google drive as following codes:</p>
  
  <pre><code>function downloadFile(fileUrl, accessToken) {
      var xhr = new XMLHttpRequest();
      xhr.open('GET', fileUrl);
      xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
      xhr.onload = function() {
          alert("xhr=" + xhr.responseText);};
      xhr.onerror = function() {alert("xhr error");};
      xhr.send(); 
  }
  </code></pre>
  
  <p>in code, fileUrl, accessToken have been obtained from a web service created to retrieve those ino. </p>
  
  <p>However, this java function was not working, responseText is empty, and readyState was 4. anyone can help? thanks.</p>
  
  <p>rgds
  brent</p>