View Full Version : Javascript History Go Back

01-11-2007, 02:07 PM
Hi all,

I'm attempting to use the javascript 'history.go(-1);' to make a page automatically return to the last page a user visited. At the moment, I can get this to work ONLY if I insert a link into the page.

What I want to happen is, the page autmatically sends the user back to the previous page after a set time.

I have this for my JS:

function backtomusic() {
window.location = history.go(-1);

And in the body section of my page I have:

<body onLoad="setTimeout('backtomusic()', 3000)">

When it runs I get an error saying 'undefined' in the browser address bar

Any ideas?

01-11-2007, 02:11 PM
Never mind guys, sussed it... window.location.replace was needed!