title: How to validate the presigned url before hitting it to download the file?
body: <p>I've a file in AWS S3 bucket. And from react app I'm generating the presigned url to download it to the user.
  I didn't used fetch(), axios.get() or https.get() because I do not want to hold the file content in the memory as we may need to process many such requests at the same time and the file size may also be huge.</p>
  <p>So we have decided to use <code>window.location = presignedurl</code> so that the user will have a feel like the file is getting downloaded from the same page.
  And this is working fine for successful download. But when there is an issue with the presigned url like, <code>nosuchkey</code>, <code>timedout</code>, <code>signaturedoesnotmatch</code> errors. These errors are thrown at the UI and not able to catch such errors as our code is not in the scope.</p>
  <p>So I have decided to do this inside a hidden iframe so that whenever there is an error, that error will be present only in hidden iframe and the user will not see it. But to catch that error and log it, I tried to access that from the parent frame. I know this is not possible due to security reasons. So I tried window.postMessage() from inside iframe to pass the content to parent.</p>
  <p>But the problem is, as I'm generating this iframe dynamically using <code>document.createElement('iframe')</code> and defined onload function of iframe as <code>iframe.onload = function() {}</code>, I'm not able to get the content out of it. Whenever I use <code>iframe.contentDocument || iframe.contentWindow.document</code> again I'm getting cross-origin issue.</p>
  <p>Is there a way to get the error message? like, is there a way to check the url has the valid file before downloading it from client browser?</p>