What's HTTP Etag?

,
Want to master JavaScript in a month? Commit. Buy Xah JavaScript Tutorial. You also get Xah HTML Tutorial and Xah CSS Tutorial.

Here a quote from Wikipedia HTTP ETag:

An ETag or entity tag, is part of HTTP, the protocol for the World Wide Web. It is one of several mechanisms that HTTP provides for web cache validation, and which allows a client to make conditional requests. This allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed.

An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.

The use of ETags in the HTTP header is optional. The method by which ETags are generated has never been specified at any time in the HTTP specification.

here's a sample HTTP header:

◆HEAD http://xahlee.info/

200 OK
Connection: close
Date: Thu, 27 Jun 2013 04:34:23 GMT
Accept-Ranges: bytes
ETag: "d0dc0093-2393-4dfed7ff74f80"
Server: Apache
Content-Length: 9107
Content-Type: text/html; charset=utf-8
Last-Modified: Mon, 24 Jun 2013 21:57:34 GMT
Client-Date: Thu, 27 Jun 2013 04:34:23 GMT
Client-Peer: 74.208.207.117:80
Client-Response-Num: 1
X-Pad: avoid browser bug

here's another example, querying Google.

◆ HEAD http://google.com/

200 OK
Cache-Control: private, max-age=0
Connection: close
Date: Thu, 27 Jun 2013 04:27:23 GMT
Server: gws
Content-Type: text/html; charset=ISO-8859-1
Expires: -1
Client-Date: Thu, 27 Jun 2013 04:27:23 GMT
Client-Peer: 74.125.239.146:80
Client-Response-Num: 1
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Set-Cookie: PREF=ID=9dc114ba5ab05743:FF=0:TM=1372307243:LM=1372307243:S=3t1GefOPQpI5FjdG; expires=Sat, 27-Jun-2015 04:27:23 GMT; path=/; domain=.google.com
Set-Cookie: NID=67=esaPZnzLc7uJW1MKobIJoRbtq_1ESpvwkaGEGJppG7hRti4B39-wpxmAA-rWpju2ajhmSNEncos17GKSMpiX_mGtbWPAqh9FBi0-8eEkKjnEtGTKo8PAKUQO9prWCQHB; expires=Fri, 27-Dec-2013 04:27:23 GMT; path=/; domain=.google.com; HttpOnly
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
blog comments powered by Disqus