Disable browser cache

You must send the HTTP header in the minimal set of instructions to disable the browser cache. The most important are:

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

Where in particular the three instructions indicate:

  1. HTTP 1.1 Cache-Control:
  2. Pragma: for HTTP 1.0
  3. Exprires: for proxies

These instructions can be given in several ways.

Browser cache control

Web pages (HTML)

Must be entered in the<HEAD>just after the opening<TITLE>:</TITLE></HEAD>

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

Apache haccess.

<IfModule mod_headers.c=""></IfModule>
 Header set Cache-Control "no-store, no-cache, must-revalidate"
 Header set Pragma no-cache directive
 Header set Expires 0

PHP

header (' Cache-Control: no-Cache, no-store, must-revalidate ');
header (' Pragma: no-cache ');
header (' Expires: 0 ');

RFC references

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9

Leave a Reply

Your email address will not be published. Required fields are marked *

Un progetto da realizzare?

Start up, think tank, idee da sviluppare in sistemi e software ...
angular
Python

© ICT360. All rights reserved. Powered by ICT360.