I've set up a simple survey page for my village, and I've been noticing that some users are having their POST submissions resubmitted without meaning to. Typically, when you go back to a page that requires a POST submission, the browser prompts you to resend data. However, users are reporting that after submitting the survey, if they navigate away and then return to the confirmation page—which has the same URL—they receive a message saying they've already submitted their data. This makes me think the browser is resubmitting the POST silently when revisiting the result page, which seems unexpected. Am I missing something? Is this behavior common nowadays?
3 Answers
It sounds like you're running into the classic Post/Redirect/Get (PRG) issue. When a user submits a form and then gets redirected, that helps avoid silent resubmissions. If you handle the POST submission by redirecting them to another page or even reloading the same URL with a GET request, that should solve the problem. It's a common pattern to implement for forms!
One very straightforward solution is to redirect users after they submit the form. Even if it's to the same URL, just ensure it's GET. This way, if users hit back or refresh, they won't trigger a POST resend.
Actually, if you’re using standard HTML form submission, refreshing the page can resend the POST request because the URL still contains valid form data. This is quite normal behavior, especially on mobile browsers, which might handle session history differently than desktop ones.
Related Questions
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads