W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2009

[whatwg] page refresh and resubmitting POST state

From: Mike Wilson <mikewse@hotmail.com>
Date: Fri, 22 May 2009 22:48:28 +0200
Message-ID: <BAY116-DAV36823ABBCFF6D71524A19A4560@phx.gbl>
Thanks for expanding on my previous mail, Jonas, but I was assuming
that everyone on this list was aware of the PRG pattern and its 
existing support in browsers. 

With current technology there are limitations to the usefulness of 
PRG (f ex in multi-window/tab scenarios), so I am asking if it is 
within HTML5's scope to explore improved or alternative solutions 
to the "resubmit" problem.

Best regards
Mike 

Jonas Sicking wrote:
> 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
> 
Received on Friday, 22 May 2009 13:48:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:49 UTC