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.


In reply to Does a browser execute a redirect before the script ends? by RaptorRex

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.