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

M lists at gazelasport.sk
Fri Jun 9 10:29:52 CDT 2006


Frank Arensmeier wrote:
> Hello Steve.
> 
> As a matter of fact, I thought about your approach already. I mean  this 
> would be better than nothing at all. And thank you for the link  you 
> provided.
> 
>> As for your problem, when the download page reloads, wouldn't the  
>> progress
>> bar just go away?
> 
> 
> The problem is that the download page doesn't reload. At least not in  
> Safari. I am not sure if other browsers handle this differently. This  
> is what happens when a user clicks on a link:
> 
> 1) The user clicks on a download link to a document which actually  
> doesn't exist.
> 2) The PDF document is generated
> 3) The PHP script will send a application/octet stream header
> 4) The script outputs the PDF document.
> 5) The script sends a redirect header to the referring page (= the  
> download page)

Don't redirect, it won't work AFAIK. You can either send a document or 
redirect.

To solve your problem, I would do it this way: PDF generating script 
saves it's progress somewhere. Clicking the link will set a javascript 
timer, that will periodicaly check with another script on the server the 
progress, and display it somehow. So you need 2 server side scripts to 
accomplish this task.




More information about the Javascript mailing list