[Solved] Browser detection in PHP causes white screen [closed]


This is my first comment here sorry if its not perfect.
I think its because you’re trying to echo everything at once.

<?php 
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE || 
    strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE ||
    strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE || 
    strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE) 
    {
                $str="<script>$(document).click(function() {";
                $str .= ' window.open("http://google.com", "_blank");';
                $str .= ' });';
                $str .= ' </script>';
                echo $str;
 } else {
                $str="<form action="http://google.com" method="get" name="redirect"></form>";
                $str .= '<script> document.forms[\'redirect\'].submit() </script>';
                echo $str;

}

?>

solved Browser detection in PHP causes white screen [closed]