开发者

HTTP Post on F5

开发者 https://www.devze.com 2023-04-04 06:35 出处:网络
Why is the default behavior of all the browsers to do HTTP POST when refreshing a page? And to submit the fo开发者_StackOverflow中文版rms.

Why is the default behavior of all the browsers to do HTTP POST when refreshing a page? And to submit the fo开发者_StackOverflow中文版rms.

This often leads to the well-known 'you're going to submit this page twice' sort of message. Which can easily(if not taken care of) execute a transcation twice (say if you're buying something).

Isn't this weird?


It's a quite standard behaviour because the state of the resource you're visiting was created by being Posted to.

Refreshing the page should re-initiate the page's state and thus a post is required.

Most of the time it's more ideal to use the Post/Redirect/Get pattern so that users are presented with a resource who's state is not dependent on a server Post.

0

精彩评论

暂无评论...
验证码 换一张
取 消