I have a button to download an excel file. When the user clicks the button, the onClick function calls
window.location= url
and when the downloading is done, the save as dialog popups with the file.
Now, I want to show a spinner until the file dialog appears. How do I do this?
I tried to create a spinner before “window.location” and hide it after that, but the spinner goes away immediately because window.location does not block until the file downloads.
Any ideas?
Thanks.
You can’t do that using just client script, because there is no event for when the download completes.
You would have to download the file through a proxy page on the server, with a unique identity in the URL so that each download could be identified. Then you could send AJAX requests from the script to the server to determine the status of the download.