Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use meta tag "Pragma" and "Expires" in head section of html

Tags:

html

Why use meta tag "Pragma" and "Expires" in head section of html like this. Thanks.

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

like image 280
FarwallGhost Avatar asked Feb 15 '14 12:02

FarwallGhost


2 Answers

Using this will disable the browser to cache your webpage.

Disabling cache has some valuable advantages.

Like when you update your files on the server, if happened that the browser doesnt have a cached copy of your webpage then it would force itself to load the updated content of your website.

One of the disadvantage of this is the impact on page downloading. Since you dont have cached copy on your browser, it will always download all of your assets from the server thus affecting time and also consuming bandwidth.

Try reading this article.

like image 109
Vainglory07 Avatar answered Oct 09 '22 23:10

Vainglory07


Both tags are meant to prevent browsers from caching the HTML page, and they usually do that. This means that access to the page may be slower especially if it is frequently visited. Probably most commonly, these tags are inserted by people who do not understand how caches work. See Caching Tutorial for Web Authors and Webmasters.

There are several way to try to prevent caching. These specific tags have no official definition, and they are not conforming according HTML5 CR.

like image 38
Jukka K. Korpela Avatar answered Oct 09 '22 21:10

Jukka K. Korpela