I am sure everybody knows that behaviour. You fill in a form on the web, and you submit it. After the submission you recognize that you filled in some wrong data. So, you click on the browsers back button. Then, sometimes the form still have the data you entered (what you are hoping in this situation) and sometimes not.
I couldn't find any connection when it is cleared and when not.
Some answers i found on the internet / stackoverflow:
But both of them are definatly wrong. I have seen sites (like one of my own) that does keep the form-data after the browser back and are using https and are using sessions.
So please: can anybody explain me how browsers are handling this stuff?
By the way: my task is it to make sure that the form data is not cleared.
A back button in the browser lets you back-up to the copies of pages you visited previously. The web browser's back and next buttons work well with web sites that provide information that changes infrequently, such as news and shopping web sites.
You can check if the user clicked the back button, disable form if true. Another way is by storing a cookie which you check on page load, if it exists you can disable the form.
I can't provide the definitive answer for all scenarios.
As a web developer, here's the rule I generally follow for sites I develop, to accomplish the goal of not letting the user lose data:
Some answers i found on the internet / stackoverflow:
1. on https connections, forms are always cleared
2. when using dynamic websites with sessions, forms are always cleared
I believe #1 varies by browser/security settings/scenario.
Assumption #2 is certainly not true in all cases (the pattern I just described leverages session and dynamic forms).
Its a browser issue. Browsers behave differently when the back button is clicked. This question was asked before here Losing form data when clicking the back button on browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With