Preventing form resubmission

前端 未结 12 1104

Page one contains an HTML form. Page two - the code that handles the submitted data.

The form in page one gets submitted. The browser gets redirected to page two. P

12条回答
  •  礼貌的吻别
    2020-11-22 10:04

    Well I found nobody mentioned this trick.

    Without redirection, you can still prevent the form confirmation when refresh.

    By default, form code is like this:

    now, change it to

    You will see the magic.

    I guess its because browsers won't trigger the confirmation alert popup if it gets a GET method (query string) in the url.

提交回复
热议问题