[whatwg] page refresh and resubmitting POST state
Jonas Sicking
jonas at sicking.cc
Fri May 22 12:50:03 PDT 2009
On Fri, May 22, 2009 at 7:06 AM, Mike Wilson <mikewse at hotmail.com> wrote:
> - potentially add constructs to help users avoid the above
> resubmit question (this could f ex be through providing
> some support for PRG = Post-Redirect-Get, or other)
This is already supported. If you use a 302 or 303 redirect in
response to a POST this will redirect to a uri that the UA then GETs.
Refresing that page will simply result in a new GET to the second uri.
Example:
product.html contains a <form method=POST action=addToCart.cgi>.
addToCart.cgi processes the parameters received from the POST request
and replies with a 302 response with Location: displayCart.cgi.
displayCart.cgi lists what is in the shopping cart.
The result of this is that once the user submits the form on
product.html, the UA will make a POST request to addToCart.cgi, then
make a GET request to displayCart.cgi and display the result of that
page. If the user refreshes the UA will again make a GET request to
displayCart.cgi and display the result.
/ Jonas
More information about the whatwg
mailing list