[Javascript] Show a progress bar while waiting for a download to begin?
Frank Arensmeier
frank.arensmeier at nikehydraulics.se
Fri Jun 9 02:23:04 CDT 2006
Hello!
I am more a PHP programmer than an JavaScript expert. So, please be
patient with me. Is there a way to show a progress bar when the user
is waiting for a download?
On one of my pages users can download dynamically generated PDF
documents by clicking on a normal <a> link. Generating a PDF document
would usually take between three and six seconds. When the document
is ready, it will be downloaded automatically (the document will not
be shown in the browser) by sending an "application/octet-stream"
header. When the server begins outputting the document, it also sends
a redirect to the original page. So basically, the user is never
leaving the page with the download links. I would like to show some
kind of progress bar or just a DIV with a simple text.
All scripts for progress bars I found on Google are dealing with the
problem that is when a user is waiting for a page to load completely
(most of them using the "onLoad" event in the body tag). Waiting for
a download to begin seems to be a different problem. I was not able
to use "onUnload" in the body tag because the download will never
trigger this event.
My idea is to have a script that is supposed to:
a) show a DIV when the user clicks on a link
b) scans/waits for a octet stream to begin
c) when the octet stream is detected (or when the redirect is
detected), hide the DIV.
Hope you get my point. Any ideas / suggestions are welcome!
Regards,
/frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060609/38bb5190/attachment.htm>
More information about the Javascript
mailing list