Not in any reliable way. Once the http server has received the full request, it is working asyncronously from the client (i.e. the browser). Once your script has received the full request, it is working more or less independently from the http server. And in any way, fully independently and asyncronously from the client browser.

Think of what your script is really asked to do.
The normal task for your script is to react upon parameters given to it, following an agreed behaviour, and then write something to stdout.
Another common agreement says that your script should write a valid HTML page to stdout, whatever that is defined as.

A CGI script is actually a rather 'dumb' piece of code, with no direct interaction with the client browser.

The http server, which is capturing what your script wrote, will try to send that output to the IP address that sent the request, to the port indicated in the same request.

The server may eventually detect that no one received what it sent down to the client (browser) but not even this is absolutely garranteed. (Think proxies, etc.) Anyway, your script would never know, because it has already terminated.

The user of the client browser may eventually have closed the application (the browser) while your script is working hard to print something to stdout that no one will ever read. :-(

f--k the world!!!!
/dev/world has reached maximal mount count, check forced.


In reply to Re: Detect Stop Button by Biker
in thread Detect Stop Button by hakkr

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.