What are the http-equiv="Pragma" and http-equiv="Cache-Control"targets for?

I am using the W3C validator in an old project and it has identified some errors in the following goals:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-cache, no-store">
<meta http-equiv="Pragma" content="no-cache, no-store">

What is their actual functionality? Are they still used?

Author: Maniero, 2019-02-05

2 answers

About error

The error is because these values for meta http-equiv are deprecated. That's why they're not valid.

insert the description of the image here

See Here which attributes are valid according to the current W3C documentation https://www.w3.org/TR/html/document-metadata.html#element-attrdef-meta-http-equiv

insert the description of the image here

Source: https://www.w3.org/TR/html/document-metadata.html#pragma-directives

About what is the Cache-Control: https://developer.mozilla.org/pt-PT/docs/Utilizando_meta_tags#Cache-Control

The Directive " cache-control:no-cache "has the same function as"pragma:no-cache". The ideal way to use this statement is to use both if it is not known whether or not the server is compatible with HTTP 1.1.

About Pragma_no-cache: https://developer.mozilla.org/pt-PT/docs/Utilizando_meta_tags#Pragma_no-cache

Causes the browser not to store the page in cache. It differs from "cache-control:no-cache " in that it is recognized by all versions of HTTP.


About HTTP caching I recommend this article from Google https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching

"retrieving something over the network is slow and expensive. Large responses require multiple back and forth between the client and the server, which slows down their availability and processing by the browser, in addition to generating data costs for the visitor. As a result, the ability to cache and reuse previously recovered resources is a critical aspect of performance optimization.

the good news is that every browser comes with an implementation of an HTTP cache. All you have to do is ensure that each server response provides the correct HTTP header directives to instruct the browser on when and for how long it can store the cached response."

insert the description of the image here

Continues here: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching

 3
Author: hugocsl, 2019-02-05 17:59:09

Whenever we see pragma in technical things it means that there will have something that is dependent on implementation, that is, each implementer of the specified technology can use that as he wants and put what he wants. In HTML the most common is to find as a compatibility mode of the Cache Control for version before HTTP 1.1. This can be seen in MDN . In practice you will hardly have problems if you do not use it, or if you have will have other well more serious for use which everyone does these days.

Just o Cache-Control it is used since 1.1 and as the name says it provides specific directives to control the cache of that Page:

Cache-Control: max-age=<seconds>
Cache-Control: max-stale[=<seconds>]
Cache-Control: min-fresh=<seconds>
Cache-Control: no-cache 
Cache-Control: no-store
Cache-Control: no-transform
Cache-Control: only-if-cached
Cache-Control: must-revalidate
Cache-Control: no-cache
Cache-Control: no-store
Cache-Control: no-transform
Cache-Control: public
Cache-Control: private
Cache-Control: proxy-revalidate
Cache-Control: max-age=<seconds>
Cache-Control: s-maxage=<seconds>
Cache-Control: immutable 
Cache-Control: stale-while-revalidate=<seconds>
Cache-Control: stale-if-error=<seconds>
 5
Author: Maniero, 2019-02-05 17:26:49