Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Cache control

What is the difference between below 3 meta tags?

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Expires" CONTENT="-1">

Do I need to use all those tags to avoid browser caching?

like image 643
Mithun Sreedharan Avatar asked Jun 23 '10 06:06

Mithun Sreedharan


People also ask

How do I set cache-control in HTML?

To use cache-control in HTML, you use the meta tag, e.g. The value in the content field is defined as one of the four values below. HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.

What is cache-control in HTTP?

Cache-control is an HTTP header used to specify browser caching policies in both client requests and server responses. Policies include how a resource is cached, where it's cached and its maximum age before expiring (i.e., time to live).

Where do I put cache-control?

To use Cache-Control headers, choose Content Management | Cache Control Directives in the administration server. Then, using the Resource Picker, choose the directory where you want to set the headers. After setting the headers, click 'OK'.

Should HTML be cached?

Do not cache HTML in the browser. Always set cache-control: no-store, no-cache before sending HTML response to the client-side. Embed fingerprints in the URL of static resources like image, JS, CSS, and font files. Safely cache static resources, i.e., images, JS, CSS, font files for a longer duration like six months.


1 Answers

See the Caching Tutorial for Web Authors and Webmasters which explains about all the different cache control headers (especially the part the explains that those meta tags are largely useless and real HTTP headers are the way forwards).

like image 107
Quentin Avatar answered Sep 20 '22 07:09

Quentin