note 7781 deleted from function.header by jimw
| From: | jimw@php.net | Date: | Wed, 31 Oct 2001 21:38:00 +0000 |
| Subject: | note 7781 deleted from function.header by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19740@lists.php.net to get a copy of this message | ||
I'm building a web-app in PHP and have had a nightmare with MSIE 4/4.5/5 cacheing pages which
shouldn't be cached. I tried sending the correct headers, which works fine with Netscape but
not MSIE. After several hours trawling through the MS developer support site I found a reference to
a refresh bug in recent versions of MSIE, and this solution which appears to work fine. It involves
a little JavaScript in addition to the correct headers:
<?
header ("Pragma: no-cache");
header ("Cache-Control: no-cache, must-revalidate, max_age=0");
header ("Expires: 0");
?>
<HTML>
<HEAD>
<TITLE>Refreshes Every Time</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function placebo() {}
</SCRIPT>
</HEAD>
<BODY onUnload="placebo()">
The page content
</BODY>
</HTML>
This isn't a PHP-specific issue so should also work fine with other approaches.
Hope this is useful, Jon.