[whatwg] page refresh and resubmitting POST state

Mike Wilson mikewse at hotmail.com
Fri May 22 13:48:28 PDT 2009


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
> 




More information about the whatwg mailing list