0

I've got a simple HTML/JS:

<form method="post" enctype="multipart/form-data" action="Service.ashx" target="download" id="uploadForm">
    <label for="x">Select file:</label> <input type="file" name="x" id="x" /> <button type="submit">Generate</button>
</form>
<iframe style="display: none" name="download" id="frmDownload"></iframe>
<script type="text/javascript">
    document.getElementById("frmDownload").onload = function () {
        alert("Yay!");
    }
</script>

In a nutshell, there's a tiny <form> which submits to a hidden <iframe>. Upon success, the Service.ashx will return a file download:

content-type: application/zip
content-disposition: attachment; filename="result.zip"

The process can take a little while (a minute or two), so I'd like to display a "Please wait, still processing" to the user. When the process completes and the file is available for download, I want to display "All done!". Unfortunately the onload script doesn't seem to get called (I'm using latest Chrome on Windows). Any suggestions how to do this?

Added: A-ha! It's a Chrome issue! And looking for Chrome specifically, looks like that's been covered already: Which JS event is fired when Chrome gets the download file?

Heh, first time I've close-voted my own topic! :)

Community
  • 1
  • 1
Vilx-
  • 104,512
  • 87
  • 279
  • 422
  • oh, Chrum .... it really does not like iframe load events does it – Jaromanda X Jan 06 '17 at 09:31
  • though - this fiddle http://jsfiddle.net/4tRWq/ works in chrum – Jaromanda X Jan 06 '17 at 09:34
  • 2
    Possible duplicate of [Which JS event is fired when Chrome gets the download file?](http://stackoverflow.com/questions/6126619/which-js-event-is-fired-when-chrome-gets-the-download-file) – Vilx- Jan 06 '17 at 10:26

0 Answers0