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

Scott Reynen scott at randomchaos.com
Fri Jun 9 11:30:18 CDT 2006


On Jun 9, 2006, at 11:04 AM, Nick Fitzsimons wrote:

> I'm surprised PHP doesn't throw an exception when you try to do this.

PHP does throw a warning, but most PHP installations don't show  
warnings because most PHP code is full of code that causes warnings,  
and it's much easier to turn them off than to fix them.

> Certainly, no browser is going to know what to do with a response  
> with two status lines, as it's a breach of the standard.

Right, but I'm not sure it's a breach of the standard to send a  
redirect 302 along with content.  Browsers aren't required to  
understand every status code, only the first digit.  So a 302 can be  
interpreted as a 300, and a 300 says:

"user agents MAY use the Location field value for automatic redirection"

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1

Or they may NOT follow the location, in which case browsers should  
show the content that follows, which would result in a user  
experience identical to a 200 response.  This is why you should  
always terminate a script (exit; in PHP) immediately after a redirect  
header to be sure nothing unwanted is shown should the redirect fail.

Peace,
Scott



More information about the Javascript mailing list