javascript PDF下载完成时jQuery检查

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3982369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 02:53:35  来源:igfitidea点击:

jQuery check when PDF download is complete

javascriptjquerypdf

提问by jhanifen

I have a link which when clicked downloads a pdf file.

我有一个链接,单击该链接会下载 pdf 文件。

Is there a way using jQuery to tell when this has occurred. Basically I want the link to change from download to please wait. And when the download is complete it will change to something else.

有没有办法使用 jQuery 来判断这种情况何时发生。基本上我希望链接从下载更改为请稍候。下载完成后,它将更改为其他内容。

The main reason is the pdf is generated server side and can take 10 or 20 seconds.

主要原因是 pdf 是在服务器端生成的,可能需要 10 或 20 秒。

采纳答案by Harmen

There is no way to check this; there is no event like ondownloadready.

没有办法检查这个;没有像ondownloadready.

But there are some work-arounds... Check this questionon stackoverflow.

但是有一些解决方法......在stackoverflow上检查这个问题