View Full Version : alternative history.go(-1)
grobar
Feb 6th 2007, 7:34 pm
Anyone know of a way to produce Something like the "onclick=history.go(-1)" command, except it would grab a fresh version of the page from the server and not just pull the old page out of the users cache.
nico_swd
Feb 8th 2007, 1:45 am
You could try using document.referrer.
function goback()
{
if (document.referrer)
{
window.location = document.referrer;
}
else
{
history.go(-1);
}
}
Untested.
rays
Feb 12th 2007, 3:39 am
there are some issues of using document.referrer
Note:
The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark). Since this property returns only a string, it does not give you DOM access to the referring page.
Ref http://developer.mozilla.org/en/docs/DOM:document.referrer
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.