最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - File download complete callback - Stack Overflow

programmeradmin0浏览0评论

I would like to able to track, purely on the client side, the progress of a file download, especially file download pletion.

Is there a JavaScript API that allows me to define a callback upon file download pletion?

I would like to able to track, purely on the client side, the progress of a file download, especially file download pletion.

Is there a JavaScript API that allows me to define a callback upon file download pletion?

Share Improve this question edited Aug 18, 2012 at 16:48 Ry- 226k56 gold badges493 silver badges499 bronze badges asked Aug 18, 2012 at 16:18 RandomblueRandomblue 116k150 gold badges363 silver badges558 bronze badges 9
  • Whether it's possibly possible depends on a couple of things, but it's probably not possible purely on the client side. You can keep track of what's been sent on the server side, though, and fetch that periodically. – Ry- Commented Aug 18, 2012 at 16:20
  • I'm my setup there is no server :0 I'm downloading a local file. – Randomblue Commented Aug 18, 2012 at 16:21
  • 3 There is no server? Where does the file that the client is downloading ing from then? Where is the file hosting your javascript code ing from then? The clouds? AFAIK without the aid of a server what you are trying to achieve is not possible. – Darin Dimitrov Commented Aug 18, 2012 at 16:25
  • Why would you download a local file? Anyway, that should be near enough instant. – Ry- Commented Aug 18, 2012 at 16:27
  • 3 @DarinDimitrov: I've found a bug in Chrome that allows me to craft a "file" locally and force Chrome to download it to the downloads folder. I just want to know once the payload has been downloaded. – Randomblue Commented Aug 18, 2012 at 16:28
 |  Show 4 more ments

1 Answer 1

Reset to default 2

No, this is not possible using pure javascript. There are some techniques though involving using cookies from the server and continuous poll from the client. I've illustrated an example here:

Hide image using Javascript after controller action is plete MVC3

发布评论

评论列表(0)

  1. 暂无评论