Yes indeed, the browser will always confirm when you are returning to a page that was the result of a POST. It may not be your case on this page, but it could be a shopping page and there would be a risk for the user to send the card twice, a purchase, etc.
It's not cool to just try to "circumvent" the browser's security accordingly. There are some people who try to use location
, but I do not think it's the ideal solution.
If you want to make a website more robust and need to use POST, read about Post / Redirect / Get
In short, this strategy makes you work like this, to ensure that the user can use the browser's return (and consequently your script too) without major problems:
- Whenever the server receives a POST, instead of returning the response directly, save the variables and return a 302 (a response header for the browser to redirect to another page)
- This new page works with GET, using the already set variables
- If the user presses the back, it will return to the GET page