Page 1 of 1

Get visitor screen resolution using PHP

PostPosted: 2013.06.16. 12:13
by rtuszendi
Get visitor screen resolution using PHP




Code: Select all
function client_screen()
      {
            if(!isset($_GET['screen_check']))
                {
                /* This code will be executed if screen resolution has not been detected.*/
                echo "<script language='JavaScript'>
                            <!--
                            document.location=\"$PHP_SELF?screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height;
                            //-->
                            </script>";
                }
            else
            {   
            /* This code will be executed after screen resolution is detected.*/
                if(isset($_GET['Width']) && isset($_GET['Height'])) {
            // Resolution  detected
            return $_GET['Width']." x ".$_GET['Height'];
           
                 }
                 else {
                           // Resolution not detected
                 return 'Resolution not detected';
                 
                 }
                 
            }