Last updated on May 23rd, 2016 at 04:06 pm

Prevent caching Firefox Internet Explorer Using no-cache

You can prevent any caching in IE by simply setting this response header:

Also check Disable Browser Back Button

Cache-Control: no-cache
Pages that use this header aren’t stored in the cache and IE will always reload them from the server; even if you use the Back button to reach them.

<?php
header("Cache-Control: no-cache, must-revalidate"); ?>

These two header values can be combined to get the required effect on both IE and Firefox:

Cache-Control: no-cache, no-store

To properly prevent the Web page from appearing in the cache, place another header section at the end of the HTML document. For example:

< META HTTP-EQUIV="EXPIRES" CONTENT="-1" />

< /HEAD>

< /HTML>

This is an example of where to place the second header section

< META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />

< /HEAD>

< /HTML>

Note: For the tag:

<meta http-equiv="expires" content="-1">

-1 means do not cache and expire straight away.

Therefore, when the user click the Back button, they will get the warning: Page has Expired – Please Refresh or resubmit information etc…. in Internet Explorer.

Note: these meta tags need to be within the HEAD section. This is very important.

Leave a Reply

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