Return to Snippet

Revision: 44736
at April 17, 2011 00:57 by prwhitehead


Initial Code
/**
* Usage: safe_redirect('http://www.google.com'); 
*
*/

function safe_redirect($url){
	?><script>
	<!--
	  window.location= "<? echo $url; ?>"
	//-->
	</script> 
  	<?  
}

Initial URL


Initial Description
If your page has already sent headers to the browser you cant redirect with headers('Location:' . $url);

But you can use the following:

Initial Title
Safe redirection

Initial Tags
javascript, php, redirect

Initial Language
PHP