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! :)