The HEAD method requests the headers that would be returned if the specified resource would be done with a {{HTTPMethod("GET")}}. Such a request can be done before deciding to download a large resource to save bandwidth.
A response to a HEAD method should not have a body. If so, it must be ignored. Even so, {{glossary("Entity header", "entity headers")}} describing the content of body, like {{HTTPHeader("Content-Length")}} may be included in the response. They don't relate to the body of the HEAD response, that should be empty, but to the body a similar request with the {{HTTPMethod("GET")}} method would have returned in its response.
If the result of a HEAD requests shows that a resource cached after a {{HTTPMethod("GET")}} request is now outdate, the cache is invalidated, even if no GET method has been done.
| Request has body | No |
|---|---|
| Successful response has body | No |
| {{Glossary("Safe")}} | Yes |
| {{Glossary("Idempotent")}} | Yes |
| {{Glossary("Cacheable")}} | Yes |
| Allowed in HTML forms | No |
Syntax
HEAD /index.html
Specifications
| Specification | Title |
|---|---|
| {{RFC("7231")}} | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
Browser compatibility
To contribute to this compatibility data, please write a pull request against this file: https://github.com/mdn/browser-compat-data/blob/master/http/methods.json.
{{Compat}}
See also
- {{HTTPMethod("Get")}}