...

View Full Version : automatical reload with history.go(-1)



joonstar
10-16-2003, 11:19 PM
<INPUT TYPE="button" VALUE="Click here to reload" onClick="window.location.reload()">

The above javascript button is for reloading.
If a user click the button, the page will be reloaded.

Now this time,
I like to make the page to be being automatical reloaded.

When the page is opened again by the code "history.go(-1),
I like to make the page to be being automatically reloaded without any click for reload button like the above javascript button.

Is that possible?

liorean
10-16-2003, 11:22 PM
Hm, have you tried to set a variable on the window first, then go back, then look for that variable? I'm not sure it works, but I've used something like it before, so it may well do.

joonstar
10-16-2003, 11:33 PM
Thanks for your suggestion.

How can I set a variable on the window first?

liorean
10-16-2003, 11:35 PM
Try window.variableName=true;

joonstar
10-16-2003, 11:42 PM
<javascript>
window.reflesh=true;
</javascript>


Like the above?

anyway I put it in the page.
I think now I have to make an automatical call the variable "window.reflesh".

Am I on the track?

and now how can I make the automatical call?

liorean
10-16-2003, 11:49 PM
if(typeof window.refresh!='undefined' && window.refresh){
window.refresh=false;
location.reload();
}

joonstar
10-17-2003, 12:02 AM
<script>
window.reflesh=true;
if(typeof window.refresh!='undefined' && window.refresh){
window.refresh=false;
location.reload();
}
</script>


I have put the above code in the page.
But It seems not to be being reloaded as I test it.

Do you see something wrong in my code?

glenngv
10-17-2003, 02:20 AM
so you want it to auto reload once?

<INPUT TYPE="button" VALUE="Back" onClick="window.name='autoreload';history.go(-1)">

then in the page opened by history.go(-1):



function autoReload(){
if (window.name=='autoreload') {
location.reload();
window.name='';
}
}
...
<body onload="autoReload()">


The problem here is if the user chooses to use the browser's BACK button instead of yours.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum