What Redirect Code to User After Saving Form
The objective is to redire开发者_JS百科ct a user after he/she saves a form, to a success page. The question is what's the best redirect method - redirect code - that should be used?
HTTP Status Codes
Technically, I think 303 is most appropriate, assuming that you always want the redirect to be executed as a GET, per the spec.
However, that won't be supported by HTTP 1.0 clients. All modern browsers should be good with HTTP 1.1 though.
302 redirects will work fine, but if browsers ever decide to implement the spec correctly (which is unlikely at this point), this may break apps because technically, it's supposed to use the same method as the original request (so if you post, it will post for the redirect as well). In fact, most web frameworks' built-in redirect functionality uses 302 redirects, not 303's, but that's just because the browsers have created a de facto standard.
精彩评论