RaptorRex has asked for the wisdom of the Perl Monks concerning the following question:
It was really hard thinking of a title for this. Here is my problem:
re: CGI, I am using inline::java to create an HTML file. After the HTML file created I want to direct the browser to it. Original code was like this (pseudoy):
java->make_HTML_file print "location: http:.....thefileitjustmade.html\n\n";
The problem is that the java class is printing to the output first (to the browser) thereby negating the redirection. I have no control over the insides of the java class so I have to accept this output.
I tried open(STDOUT,">/dev/null") but that didn't stop the output. The output, btw, is just a string of dots to indicate progress (this is meant to run on a command line).
I have it working now, but then comes my question.
I moved the redirection header high high above the class call in the code. Now the redirection is sent to the browser very early, long before the html file is made.
My worry is, that since the redirection is to the html file that the java is creating, that the browser will go to the file before it is finished being made.
So my questions is: what signals to a browser to proceed onto the new location? is it as soon as it receives the redirection line? or is it not until after the script completes? it does seem to work, but I want to know definitively.
Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Does a browser execute a redirect before the script ends?
by shmem (Chancellor) on Jun 06, 2007 at 13:46 UTC |