PDA

View Full Version : goback and reload


loophole
04-23-2003, 05:54 AM
I have a button as follows.
<INPUT TYPE="button" VALUE="< Go Back" style="font-family: Verdana; font-size: 8pt; color: #FF0000" onClick="history.back()">

Now need to automatically refresh the page after going back. Since the page has form results the broswer is requesting to refresh.
Does anyone know what i can add to the onclick script to goback and then refresh automatically.


thanks,
Hasan

glenngv
04-23-2003, 10:35 AM
onclick="location.href='url'">

or

onclick="location.replace('url')">

the last one will replace the current page in the history

if the previous page's url contains querystrings where the values are dynamic, just use document.referrer as the url:

onclick="location.replace(document.referrer)">

liorean
04-23-2003, 10:57 AM
Using location.replace doesn't work in mozilla (or at least didn't a while back). Motivation for that change in security level is "Replacing a page in the session history is an intrusion of the personal integrity of the user, and as a feature should be reserved for the user alone".

glenngv
04-24-2003, 02:44 AM
it works for me in Mozilla 1.0/Win

liorean
04-24-2003, 03:13 AM
Yep - checking back, it was changed in 0.9.7, seemingly because of the number of bug reports on the subject.