Reputation: 7869
This is an html metatag example:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="private">
It's set on the html metatag to enable caching.
I tried it with Tomcat and Firebig. The server send the information in the html metatag. but there is no information about caching in the http header response.
However something like this in an http header response is valid:
Cache-Control: private
So I was wondering: when the information is written in the http response?
What's the need of having two way of setting the same information (metatag and http response line)?
Upvotes: 4
Views: 2024
Reputation: 83071
From the HTML 4.01 spec
The META element
http-equiv = name [CI]
This attribute may be used in place of the name attribute. HTTP servers use this attribute to gather information for HTTP response message headers.
That was the idea. It was the job of the server to convert the meta elements into real HTTP headers before they sent it over the wire.
But that meant that servers had to parse every HTML document before they sent it, and so it practically never happened.
Browsers picked up the pieces as best they could, but caching rules apply to proxies too, and those will only process real HTTP headers, so cache-control http-equiv meta elements are not valid in HTML5.
You should always use real HTTP headers, which are either added by the server as part of its configuration, or in server-side code (i.e., code written in PHP, Java servlets, ASP.NET etc.)
Upvotes: 5