Javascript redirect on Meta Refresh - can it be done?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Javascript redirect on Meta Refresh - can it be done?

Post 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?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

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

Post by Darhazer »

why not just:

Code: Select all

echo '<script type="text/javascript">window.history.go(-1);</script>';
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

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

Post by simonmlewis »

Brilliant thank you.
Again, apologies if this was meant for a javascript thread.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply