Created
August 26, 2014 16:37
-
-
Save DeveloperWil/2872519c2fdf7cbf0dbe to your computer and use it in GitHub Desktop.
JS PHP redirect function. Use when Headers have already been output to screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function lc_js_redirect($url, $seconds=1){ | |
| 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; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment