This might not be a great question to ask. However, when you have a form and after a thank you page appears after the form. If someone press Ctrl+R on chrome, it resubmits the data. Is there any way to stop resubmitting data in the browsers? Basically Instead i want it to reload the form and make the user fill it in again. Is there a way to stop explicitly say to browser that after this point stop caching?
Asked
Active
Viewed 51 times
0
-
That's not possible. Refreshing is browser behavior, it's outside of the control of your site. – Kenneth Jan 24 '14 at 13:33
-
@Kenneth not 100% true.. – Daniel W. Jan 24 '14 at 13:34
-
I am not using PHP. I am using basic java, Struts, html/css – Jan 24 '14 at 13:39
-
@user3218006 HTTP is not PHP specific – Daniel W. Jan 24 '14 at 13:40
-
oh ok didnt realize the question has answers that are general.. cause the question itself seems like for PHP specific.. looking at it.. though still a little confused – Jan 24 '14 at 13:42
-
@user3218006 exactly, it's not about PHP, it's mainly about HTTP headers/status codes sent in the right order. The browser remembers the last HTTP interactoin and if it contained form data, it will pop up if you'd like to resend.. – Daniel W. Jan 24 '14 at 13:46
1 Answers
2
This has nothing to do with caching, although the browser does temporarily store the form data when you refresh or hit the back button. This is browser specific, which is out of your control, however, this behaviour can be circumvented:
by submitting the form data via ajax
by forcing a non-POST request after the form data POST request

Daniel W.
- 31,164
- 13
- 93
- 151