dcoder
2013-01-31 03:29:56 +08:00
<Head First HTML>书上的原话:
There’s a couple of big differences that really matter. If you want users to be able to bookmark pages that are the result of submitting a form, then you have to use GET, because there is no way to bookmark a page that has been returned as a result of a POST. When would you want to do that? Say you have a Web application that returns a list of search results; you might want users to be able to bookmark those results so they can see them again without having to fill out a form.
On the other hand, if you have a Web application that processes orders, then you wouldn’t want users to be able to bookmark the page. (Otherwise, every time they returned to the bookmark, the order would be resubmitted.) A situation when you’d never want to use a GET is when the data in your form is private, like a credit card or a password. Because the URL is in plain view, the private information is easily found by others if they look through your browser history or if the GET somehow gets bookmarked. Finally, if you use a <textarea>, you should use POST, because you’re probably sending a lot of data. GET requests have a limit of 256 characters; POST has no limit on the size of the data package you send.