下载附件的javascript事件?

发布于 2024-09-26 15:49:03 字数 149 浏览 1 评论 0原文

我有一个生成报告的页面,该报告作为附件发送到浏览器。 我想做的是..禁用生成报告按钮,或显示旋转,请稍候,当附件完成生成并已发送到浏览器时,我想删除旋转徽标/重新启用按钮..

是否有一个js事件,例如附件完成或类似的事件?

谢谢纳特

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花期渐远 2024-10-03 15:49:03

是否有像 AttachmentComplete 之类的 js 事件?

不。文件的下载完全不受 JavaScript 的控制。

我想到的唯一方法是让生成报告的脚本更新某种标志(例如临时文件),您可以使用 Ajax 经常从页面轮询该标志。当脚本生成数据完成后,您将删除该标志。

不过,您需要决定是否值得为了一个小的 UI 效果而付出努力。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文