Forum Moderators: open

Message Too Old, No Replies

history.back(1) question

How do i redirect to the previous page after 5 seconds?

         

is300

6:36 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



Here's what I have so far, everything is right except for redirURL line. I'm not sure what it should =

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
redirTime = "5000";
redirURL = "history.back(1)";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>

THANK YOU SO MUCH!

isitreal

7:46 pm on Feb 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you want it to go back try this:

redirURL = window.history.go(-1);

If it works with that, you're done, if it doesn't, you might need to make a little function to call in the settimeout instead of having the actual code in there.

is300

9:21 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



It didn't work....but thank you.

I'm no expert at writing functions. I know how to integrate existing scripts, but thats as far as I can go with javascript...as i'm actually photographer. any other ideas?

is300

9:24 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



I forget to mention that when i put your redirURL = window.history.go(-1); in, it seems to redirect immediately rather than delaying. i really need the delay.

isitreal

10:04 pm on Feb 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You're right, it doesn't work, I'll see if I can figure that out.

whoisgregg

7:27 pm on Feb 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put this in your head section of the page:

<meta http-equiv="refresh" content="5;URL=javascript:history.go(-1);">

:) Tested on Safari