...

View Full Version : refreshing the cache...



Sc0rian
05-04-2006, 11:03 AM
Hi guys..

i keep changing the link for the url-redirect because its for ever moving around to different servers... when people go on the website alot of the browsers remember the URL address from the browsers cache... i tried to make javascript code to get around this.. but have failed... was wondering if any of you could help?

thanks
ben

Kor
05-04-2006, 11:19 AM
The only way (except if your page is a dynamic one - php, asp...) is to add a unique variable to your location as a query. The best variable will be the Date in milliseconds (as it is a variavle which is changing all the time. In this case as the location href is always different from the url in cache, the browser will be forced to load it from server. Should work most of the time.

Try:



<script type="text/javascript">
var lastTime = location.search.substring(1) - 0;
(new Date()).getTime() - lastTime > 1000?location.href = location.href + '?' + (new Date()).getTime():null
</script>

Sc0rian
05-04-2006, 04:08 PM
thanks alot :) it seems to work...

great help

Ben



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum