[Javascript] Show a progress bar while waiting for a download to begin?

Steve Clay sclay at ufl.edu
Fri Jun 9 07:57:48 CDT 2006


Friday, June 9, 2006, 3:23:04 AM, Frank Arensmeier wrote:
> 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.

Unless your backend gives you access to its generation progress (or even if
it does), I recommend faking it. Create a DIV that stretches with time but
continuously slowing:

http://mrclay.org/js/transition/fake_progress.html
This uses a simple animation library I worked on a few months ago.
1. t = new Transition(lengthOfTimeInMs, desiredFps);
2. attach elements/frame functions/an end function to t.
3. t.begin();

Aside: I don't know why, but setInterval doesn't seem too accurate in Opera
and IE (a 10s transition takes around 13s), but FF1.x is right on the money.

As for your problem, when the download page reloads, wouldn't the progress
bar just go away?

Steve
-- 
http://mrclay.org/




More information about the Javascript mailing list