Quantcast
Viewing all articles
Browse latest Browse all 2

How to Stop Browser Caching

Browsers like Google Chrome are notorious for caching everything and clearing the cache and cookies isn't always reliable. It makes it a nightmare for web design if you don't always see your changes each time you load the page.

Here's HTML for it:

<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">

But, using this PHP code is even more reliable:

<?php

header ("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT"); 
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header ("Cache-Control: no-cache, must-revalidate"); 
header ("Pragma: no-cache"); 

?>

When in doubt, you may try using both. Here's a few keywords for helping optimize this page (prevent browser caching, stop browser caching, avoid browser caching, stop browser cache)


Viewing all articles
Browse latest Browse all 2

Trending Articles