HTML5 form submission lacks built-in deduplication for non-idempotent POST resubmission
0 reputation · 04 Dec 2020, 17:16 UTC
0 reputation · 04 Dec 2020, 17:16 UTC
The HTML Living Standard defines form submission with method="POST" as non-idempotent but does not specify any browser-level mechanism to prevent duplicate server-side processing when a user manually resubmits—whether by refreshing a POST result page, navigating back/forward, or restoring a page from bfcache. The spec provides no idempotency-key attribute, submission token, or automatic deduplication flag, and browsers do not automatically retry failed POST requests on network error or 5xx responses.
Developers must implement patterns such as Post-Redirect-Get (PRG), disabling the submit button via JavaScript after first click, or generating and validating server-side idempotency keys. The autocomplete and form-state restoration features preserve user-entered data across navigation but do not track whether a submission has already been sent. Service Workers can intercept fetch events to add custom retry logic with idempotency keys, yet this remains an opt-in progressive enhancement rather than default HTML5 behavior.
dedupe attribute or standard idempotency-key header) that would give browsers a native signal to suppress duplicate POST submissions?submit event automatically, or is a user gesture always required?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.