Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript event for attachment downloaded?

i have a page that generates a report, the report is sent to the browser as an attachment. what i would like to do is .. disable the generate report button , or show a spinny please wait, and when the attachment has finished being generated and has been sent to the browser i'd like to remove the spinny logo/re-enable the button..

is there a js event like, on attachmentcomplete or some such?

thanks

nat

like image 750
nat Avatar asked Sep 12 '26 04:09

nat


1 Answers

is there a js event like, on attachmentcomplete or some such?

No. The downloading of files is entirely outside of JavaScript's control.

The only way that comes to mind is having the script that generates the report update some sort of flag (e.g. a temporary file) that you can frequently poll from your page using Ajax. When the script is done generating the data, you would delete the flag.

You'll need to decide if it's worth the effort just for a small UI effect, though.

like image 184
Pekka Avatar answered Sep 13 '26 19:09

Pekka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!