Konstantin Konstantin - 5 months ago 14
Javascript Question

What event is fired when clicking on a download link and the file saving dialog appears?

File is served dynamically, starting the server side script and generating the output is time consuming, sometimes 5-10 sec. I would like to show a "please wait" message near the download link, till the download process really starts. When file saving dialog appears, I would like to make the "please wait" message simply disappear. The download and save dialog is triggered by server side as writing to the standard output of CGI application, and attaching a MIME type "application/force-download" header. Is it possible somehow to track the file download dialog?

Answer

You can use data-disable-with attribute of html. its simply appear on button click and disappear when server respond back.

Ex.

<input type="submit" data-disable-with="Please wait while downloading.." autocomplete="off">