2

In the early days of the web it was a problem that clicking the browser's Back button after clicking Submit could cause the form to be resubmitted so one might, for instance, end up with a double purchase.

This does not seem to be a problem any longer. How was it fixed? Do individual sites have to work around this or did browsers change?

3

One way to prevent this is to use the POST/Redirect/GET pattern.

Instead of directly sending a 200 after receiving the POST request, the server sends a 303 (or 302) redirect instead. The client follows it and gets (via GET) a 200 then. Refreshing this page repeats the last GET, not the previous POST.

For implementation questions, see the Stack Overflow tag "post-redirect-get".

  • And in regards to the direct question, when you press Back in the browser you go back to the initial page, not the intermediate POST request. – DisgruntledGoat Nov 30 '15 at 1:18
0

I've used a javascript POST of the form data followed by a js re-direct. Using the back button doesn't cause those forums to be re-submitted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.