In my project I am using below Javascript code history.back(); for gooing back to previous page.(like back arrow on window). This function is working fine on IE and Firefox but not on google crome?
<input type="button" value="Go back" onclick="history.go(-1); return false" />
I get the error bellow
Confirm Form Resubmission
This web page requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed. Press Reload to resend that data and display this page.
Did googling but everybody is suggesting history.go(-1);return false; but it does not work either. Also tried history.back() but that does not help too
The previous page was displayed after a POST request (usually occurs when submitting a form). That means, to display the previous page, the form data, which was submitted in the POST request, must be submitted again. It has nothing to do with your history.go(-1)
of Javascript, it will also occur when you press the back button of your browser.
You can use the Post Redirect Get pattern do work around this problem.
You can also use GET on your form instead:
<form action="..." method="GET">
However, do not use this for forms where data is added on your server, or it will be submitted everytime the user the back button and comes back to this page. See also: When should I use GET or POST method?
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