Javascript Redirect
With this function you can easily redirect to another page, after a certain amount of time (in seconds).
<?php
function js_redirect($url, $seconds=5) {
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide from old browser\n\n";
echo "function redirect() {\n";
echo "window.location = \"" . $url . "\";\n";
echo "}\n\n";
echo "timer = setTimeout('redirect()', '" . ($seconds*1000) . "');\n\n";
echo "-->\n";
echo "</script>\n";
return true;
}
?>
December 31st, 2005 at 2:00 pm
Thank you very much
April 4th, 2006 at 11:31 am
Why not do it using just plain PHP? It will be much easier to just create something like below:
April 25th, 2006 at 9:41 pm
because if you did it in plain php header, you wouldnt be able to edit cookies and have them affect the current page.
July 18th, 2006 at 11:32 am
where do i put the page i want it to redirect too??