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
1 Answer
Reset to default 2No, 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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745223666a4617361.html
评论列表(0条)