title: Downloading Excel (.xlsx) File In Frontend Javascript Via Amazon Presigned URL
body: <p>I have an amazon S3 URL being passed back to me from an external service that is in the format:</p>
  <p><a href="https://foo.s3.amazonaws.com/ProjectDownloads/foo/title.xlsx?AWSAccessKeyId=foo&amp;Expires=1602279238&amp;Signature=foo" rel="nofollow noreferrer">https://foo.s3.amazonaws.com/ProjectDownloads/foo/title.xlsx?AWSAccessKeyId=foo&amp;Expires=1602279238&amp;Signature=foo</a></p>
  <p>I haven't worked much with S3, but my understanding is this is a Presigned URL - I can paste it in my browser and the excel file downloads.</p>
  <p>How can I download this file directly using javascript (on the frontend, as my system is not running node)?</p>
  <p>I have tried generating an  tag element with click - however all my files download as corrupt.  I can download the file directly by pasting the link in my browser and it auto initiates a download.</p>
  <p>Any help will be appreciated.</p>
  <p>I have tried the following, but it downloads a file with error:</p>
  <pre><code>    var link = document.createElement('a');
      link.href = url;
      link.download = 'foo.xlsx';
      document.body.appendChild(link);
      link.click();
      document.body.removeChild(link);
  </code></pre>