[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
Single Page
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?
-
Search the FAQ Archives
Single Page
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?
3.14 Can I run a CGI script without returning a new page to the browser?
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.
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 | Search | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>
Last Update December 05 2008 @ 00:13 AM