停止浏览器要求在刷新时重新发送表单数据? [英] Stop browsers asking to resend form data on refresh?
问题描述
我通过POST提交表单。我提交表单,一切正常,但是如果我尝试重新加载表单提交后的新页面,则会显示您要重发数据消息(FireFox)。它可能发生在其他浏览器,但我不知道。
有谁知道一种方法来阻止此消息弹出,所以我可以继续刷新页。这对于生产环境并不好 - 用户可能会提交两次相同的表单!
您需要使用POST-Redirect- GET pattern。
让你的表单响应一个GET请求的重定向。
这样,当用户刷新页面时,它只会重新发送GET。
I have a form submission via POST. I submit the form, and all is well, however if I try to reload the new page that the form goes to after submission, I get the "Do you want to resend data" message (FireFox). It might happen in other browsers too, but I'm not sure.
Does anyone know of a way to stop this message popping up so I can go ahead and refresh the page. It's not good for production environments - users may submit the same form twice!
You need to use the the POST-Redirect-GET pattern.
Make your form respond with a redirect to a GET request.
This way, when the user refreshes the page, it will only re-send the GET.
这篇关于停止浏览器要求在刷新时重新发送表单数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!