Reputation: 2244
There is a link on my page to a pdf file. Clicking on the link takes a really long time, so I'd like to throw up a progress indicator gif showing that it is something that takes a while. But how do you hide the indicator once the pdf has been generated on the server side and finished downloading? (basically your browser now says you are opening a pdf file and asks you what to do)
at this point is there an event that fires or anything I can poll to check to hide the progress indicator?
Upvotes: 1
Views: 3612
Reputation: 114417
JavaScript does not have access to information on what's being downloaded. The only thing you can do is load the PDF in a Iframe and hook up the onload event on the Iframe. Even then the event will fire when the PDF starts loading, not when it is complete.
EDIT: kalendae has alternate answer.
If you have server-side access you can set a cookie with the response and poll for its value on the client.
Upvotes: 3