Using no-cache for Stop Caching in Firefox and Internet Explorer
You can prevent any caching in IE by simply setting this response header:
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”); ?>
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.
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:
<html>
<head>
<meta HTTP-EQUIV=”REFRESH” CONTENT=”5″>
<title> Pragma No-cache </title>
</meta></head> <body>
This is an example of where to place the second header section<br /> so that the “Pragama, No-Cache” metatag will work as it is supposed to.<br /> </body>
<head> <meta HTTP-EQUIV=”PRAGMA” CONTENT=”NO-CACHE”>
< META HTTP-EQUIV=”EXPIRES” CONTENT=”-1″ />
< /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.
Related posts:
- “Header already sent” in php error and other use of Header function in PHP
- Caching of images using javascript image object
- Add to favorites or bookmarking using javascript in firefox and internet explore [IE]
- Caching of web page using php
- Check whether the browser is Internet Explorer or not using javascript
- Adding a draggable div along with the cursor using simple javascript
- Image preloader using CSS
