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.
精彩评论