问题
What is the reason that we cannot use the browser Back button when we submit a page using HTTP POST? But it is fine with HTTP GET? I have read that the browser tries to prevent multiple POSTS (to avoid multiple updates to server) because it cannot tell the difference between BACK and RELOAD on the browser? How can browser not tell between BACK and RELOAD?
回答1:
Back isn't a special request that goes to the server. Back just navigates to the previous page, same as if you just entered the url in the navigation bar and hit go. It's really the same thing as a reload which is the same as a basic page request from the server's point of view. They're all just GET requests.
When you hit back on a page that used a post, it resends a post rather than a get. Generally browsers have built in protections against that ("Are you sure you want to go back? Browser will resend previously submitted information").
The reason it doesn't reload posts like that is because, like you said, it doesn't want to resend the information used to get that page to the server, because it'll double post something, or double buy something.
来源:https://stackoverflow.com/questions/16091067/why-does-the-back-button-not-work-with-http-post