No-cache for IE and Netscape not working in all cases

liunx

Guest
Despite trawling the web for solutions, I'm still unable to prevent caching on all browser types. For example I can prevent caching on IE6 with Win-XP but not IE6 running on Win-9x.<br />
<br />
This is what I've got so far (Perl script):<br />
QUOTE<br />
my $browser = $ENV{'HTTP_USER_AGENT'};<br />
if ($browser=~m/MSIE/i) { <br />
print "Cache-Control: no-cache"; <br />
# Works with Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) <br />
print "Content-type:text/html\n\n";<br />
} <br />
else {<br />
print "Content-type:text/html\n\n";<br />
#If the cache-control printout appears before "Content-type" Netscape fails to interpret HTML code, so leave it out when Netscape detected.<br />
} <br />
UNQUOTE<br />
<br />
For other browsers I have the following additional code in two HEAD tag instances placed before and after the BODY section, the second instance being for the IE 64k buffer problem:<br />
QUOTE<br />
<head><br />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> #for Netscape and IE<br />
<META HTTP-EQUIV="Expires" CONTENT="-1"> #for IE5 <br />
</head><br />
UNQUOTE<br />
However none of this works for <br />
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90), Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC) or <br />
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.7 <br />
<br />
What have I missed?<br />
<br />
Roger Hough<!--content-->#If the cache-control printout appears before "Content-type" Netscape fails to interpret HTML code, so leave it out when Netscape detected. <br />
That's because you forgot the end of line on the cache header. That may be your whole problem. If not then also include a meta tag for the cache-control header as well as the pragma header. Those are for two versions of http.<!--content-->
 
Back
Top