Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

FAQ: Frequently Asked Questions about CGI Programming
Section - 3.14 Can I run a CGI script without returning a new page to the browser?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]


Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 3.13 Can I redirect users to another page?
Next Document: 3.15 Can I write output to a different Netscape frame?
See reader questions & answers on this topic! - Help others by sharing your knowledge

Yes, but think carefully first:  How are your readers going to know
that their "submit" has succeeded?   They may hit 'submit' many times!

The correct solution according to the HTTP specification is to
return HTTP status code 204.   As an NPH script, this would be:

	#!/bin/sh
	# do processing (or launch it as background job)
	echo "HTTP/1.0 204 No Change"
	echo

(as non-NPH, you'd simply replace HTTP/1.0 with the Status: CGI header).

Alan J Flavell has pointed out that this will fail with certain
popular browsers, and suggests a workaround to accommodate them:

[ May 1998 update[1]: I'm deleting Alan's suggestion, because the problem
  is mainly of historical interest, and the workaround is no longer
  recommended.  See his page for a a detailed survey and recommendations.
]

His survey is at
http://ppewww.ph.gla.ac.uk/%7Eflavell/status204/results.html

[1] With apologies to Alan for having left it in so long.


User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 3.13 Can I redirect users to another page?
Next Document: 3.15 Can I write output to a different Netscape frame?

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>





Last Update March 27 2014 @ 02:12 PM