Page 1 of 1

Javascript redirect on Meta Refresh - can it be done?

Posted: Sat Jul 03, 2010 4:33 pm
by simonmlewis
Sorry if this is not a PHP question, but it's in a PHP page.

I have a LONG url to take someone back to, and after posting date, I think the best way to handle it is to taken them to a script, run it (send email), and then do a html REFRESH which takes them back 2 pages.

I just cannot figure out anyway to do that. I cannot give the URL to the page as it doesn't seem to store it correctly in a variable.

So basically something like this:

Code: Select all

echo "<meta http-equiv=\"Refresh\" content=\"0 ;URL=javascript: window.history.go(-2)\">";
What's wrong here?

Re: Javascript redirect on Meta Refresh - can it be done?

Posted: Sat Jul 03, 2010 4:50 pm
by Darhazer
why not just:

Code: Select all

echo '<script type="text/javascript">window.history.go(-1);</script>';

Re: Javascript redirect on Meta Refresh - can it be done?

Posted: Sun Jul 04, 2010 3:46 am
by simonmlewis
Brilliant thank you.
Again, apologies if this was meant for a javascript thread.