...

View Full Version : can u force "clear cache"



fluid01
11-03-2003, 11:42 PM
hello,

is there a ay that I can force someones browser to automatically reload when they visit a site? this is the problem: when someone tries to view a site, they are not seeing the most recent changes.. i figure there is proabably some sort of code that i can use to "force" there browser to automatically reload so they are always seeing the most current version of the site....

thanks for all you help! everyone here has been very helpful in the past...

fredmv
11-03-2003, 11:46 PM
In your <head>:
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />Good luck.

Willy Duitt
11-04-2003, 04:16 AM
Honestly, I'm not completely convinced this script works.
Therefore, I could use yours and others testing and input. :cool:

What it does is append the UTC time as a querry to your URL
My theory is this should be another unique URL and therefore
not cached.

Input invited. :thumbsup:

<script type="text/javascript">
<!--
function reloadIt() {
var clocktime = new Date();
var utchours = clocktime.getUTCHours();
var utcminutes = clocktime.getUTCMinutes();
var utcseconds = clocktime.getUTCSeconds();
var utcyear = clocktime.getUTCFullYear();
var utcmonth = clocktime.getUTCMonth()+1;
var utcday = clocktime.getUTCDate();

if (utchours <10) { utchours = "0" + utchours }
if (utcminutes <10) { utcminutes = "0" + utcminutes }
if (utcseconds <10) { utcseconds = "0" + utcseconds }
if (utcmonth <10) { utcmonth = "0" + utcmonth }
if (utcday <10) { utcday = "0" + utcday }

var utctime = utcyear + utcmonth + utcday;
utctime += utchours + utcminutes + utcseconds;
x = utctime

isNew = self.location.href
if(!isNew.match('#','x')) {
self.location.replace(isNew + '#' + x)
}
}

//-->
</script>

</head>
<body onLoad="reloadIt()">


.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum