in reply to CGI redirection after headers sent

I do a quick-and-dirty version, no redirect, with javascript.

I output this as soon as the script starts (setting $| to 1 first of course):

<img name="progress" src="animated.gif">

which is an animated progress-bar type image -- then when the script is finished/starting to produce output I print this to the browser:

<script> document.images.progress.src='finished.gif'; </script>

Which changes the gif to one which says "done" or is just transparent.

Although of course if the perl script itself times out/fails and produces no further output they're left with the animated gif forever. That could be handled with a setTimeout() in javascript though, allowing two or three minutes then resetting the image and giving some kind of error. Your <script> block would in that case include a clearTimeout() as well. Exercise for the reader.

Please note I only ever did this for internal apps where I could be absolutely sure the users had javascript and had it turned on.



($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print