Forum Moderators: open
<script type="text/javascript">
function loaded()
{ if (!navigator.fudge) {
navigator.fudge = 1;
location.reload();
}}
</script>
<script language=" JavaScript" ><!--
function MyReload()
{
window.location.reload();
}
//--></script>
I have tried more, but dont want to take up the space. It needs to be done everytime the page is visited and automatically. Thanks in advance!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- doctype all on one line -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<script type="text/javascript">
window.onload=function() {
if (document.cookie!="reloaded=1") {
// using setTimeout to make sure it works,
// remove after testing.
var v = setTimeout('reloadWindow()',5000);
}
else {
document.getElementById('cookie-result').innerHTML=document.cookie;
}
}; // <-- not a typo
function reloadWindow() {
document.cookie="reloaded=1";
window.document.location.reload();
}
function clearCookie() {
if (document.cookie) { document.cookie="reloaded=''"; }
document.getElementById('cookie-result').innerHTML=document.cookie;
return false;
}
</script>
</head>
<body>
<p>Load the page. Wait 5 seconds. The cookie will say
"reloaded=1" below. Clear the cookie first to retest.
Remove the setTimeout if it is what you're after.</p>
<p> Testing: <span id="cookie-result">Cookie Result will appear here.</span></p>
<p>Added to clear the session cookie for retesting:</p>
<form action="" onSubmit="return clearCookie();">
<input type="submit" value="Clear Cookie">
</form>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
{
document.write('page refreshed');
}
else
{
username="bob";
{
setCookie('username',username,365);
setTimeout("window.location.reload()",2000);
}
}
}
</script>
</head>
<body onload="checkCookie()">
</body>
</html>
Or if there is a code delete the cookie, but the page to delete the cookie would be in a different path that could work.
Thanks again! :)
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setMinutes(exdate.getMinutes()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
{
}
else
{
username="refresh";
{
setCookie('username',username,1);
setTimeout("window.location.reload()",1000);
}
}
}
</script>
</head>
<body onload="checkCookie()">