HTTP协议中 204 No Content 成功状态响应码表示目前请求成功,但客户端不需要更新其现有页面。204 响应默认是可以被缓存的。在响应中需要包含头信息 ETag

使用惯例是,在 PUT 请求中进行资源更新,但是不需要改变当前展示给用户的页面,那么返回 204 No Content。如果新创建了资源,那么返回 201 Created 。如果页面需要更新以反映更新后的资源,那么需要返回 200

状态

  1. 204 No Content

规范

SpecificationTitle
RFC 7231, section 6.3.5: 204 No ContentHypertext Transfer Protocol (HTTP/1.1): Semantics and Content

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
204ChromeFull support YesEdgeFull support YesFirefoxFull support YesIEFull support YesOperaFull support YesSafariFull support YesWebView AndroidFull support YesChrome AndroidFull support YesEdge MobileFull support YesFirefox AndroidFull support YesOpera AndroidFull support YesSafari iOSFull support YesSamsung Internet AndroidFull support Yes

Legend

  • Full support
  • Full support

参见

文档标签和贡献者

标签:

此页面的贡献者:mdnwebdocs-bot, WayneCui, fscholz, abc950309

最后编辑者:mdnwebdocs-bot,