Created
July 12, 2014 23:03
-
-
Save SecureCloud-biz/0132bcf7ab9c0180d6bf to your computer and use it in GitHub Desktop.
PHP_screen_resolution
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
<?php | |
session_start(); | |
if (isset($_SESSION['screen_width']) AND isset($_SESSION['screen_height'])) { | |
echo 'User resolution: ' . $_SESSION['screen_width'] . 'x' . $_SESSION['screen_height']; | |
} else if(isset($_REQUEST['width']) AND isset($_REQUEST['height'])) { | |
$_SESSION['screen_width'] = $_REQUEST['width']; | |
$_SESSION['screen_height'] = $_REQUEST['height']; | |
header('Location: ' . $_SERVER['PHP_SELF']); | |
} else { | |
echo '<script type="text/javascript">window.location = "' . $_SERVER['PHP_SELF'] . '?width="+screen.width+"&height="+screen.height;</script>'; | |
} | |
/* returns => 1600x900 */ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment