Read up on NPH scripts.

Update:

While NPH would do what you said in the subject (unless the browser waits for the whole page to be received before rendering the page), it's not well suited to provide a "Please Wait" screen. Specifically, it doesn't allow you to remove any "Please Wait" messages you have sent* (without using ill-supported Server Pushes).

What you want to do is usually done as follows:

  1. Start an external process to perform the requested task. (Alternatively, you can send the request to an existing process.)
  2. Give a please wait response to the client, and have the client Refresh itself after a time interval.
  3. When the client refresh itself, check if the task is done. If the task is not done, repeat the last step.
  4. Display the result.

Instead of using the HTTP Refresh header, you can use any of Java, Flash or JavaScript (AJAX) to check whether the task has been completed or not. I wouldn't use them.

Update:

* – I suppose you could send JavaScript which modifies the document being viewed.


In reply to Re: Sending html content to the browser as the script runs by ikegami
in thread Sending html content to the browser as the script runs by perljunkymunky

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.