K
kieran5405
Hi,
I have an Intranet page that has an image that changes each day, but
the image is caching and not updating until the user manually does a
page refresh. I want the page to refresh itself but i dont want to use
a timed refresh such as every 5 mins etc. I want it so when the user
comes in in the morning and opens the page it will have the updated
image immed.
I am thinking that JavaScript code to check for a cookie and if it is
not there perform a page refresh. Then write the cookie to the user's
computer that has a life span of 8 hours. That way the cookie should
expire by the next morning as most users leave at 5pm.
I am using the following code but cant seem to get it to work - or even
write the cookie.
Any help much appreciated.........
<code>
<SCRIPT LANGUAGE="JavaScript">
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 60*60*24*365)
cookie_name = "imageCookie";
if(document.cookie)
{
index = document.cookie.indexOf(cookie_name);
if (index != -1)
{
//refresh page
location.reload();
//create new cookie
document.cookie=cookie_name +"; expires=" + expire.toGMTString()
}
}
</SCRIPT>
</code>
I have an Intranet page that has an image that changes each day, but
the image is caching and not updating until the user manually does a
page refresh. I want the page to refresh itself but i dont want to use
a timed refresh such as every 5 mins etc. I want it so when the user
comes in in the morning and opens the page it will have the updated
image immed.
I am thinking that JavaScript code to check for a cookie and if it is
not there perform a page refresh. Then write the cookie to the user's
computer that has a life span of 8 hours. That way the cookie should
expire by the next morning as most users leave at 5pm.
I am using the following code but cant seem to get it to work - or even
write the cookie.
Any help much appreciated.........
<code>
<SCRIPT LANGUAGE="JavaScript">
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 60*60*24*365)
cookie_name = "imageCookie";
if(document.cookie)
{
index = document.cookie.indexOf(cookie_name);
if (index != -1)
{
//refresh page
location.reload();
//create new cookie
document.cookie=cookie_name +"; expires=" + expire.toGMTString()
}
}
</SCRIPT>
</code>