Last active
August 29, 2015 14:03
-
-
Save daliborgogic/08de55646db75f2292d2 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
<!DOCTYPE html> | |
<html class="no-js"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="HandheldFriendly" content="True"> | |
<meta name="MobileOptimized" content="320"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"> | |
<meta http-equiv="cleartype" content="on"> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
</head> | |
<body> | |
<? | |
if(!isset($_POST['width']) || !isset($_POST['height'])) { | |
echo ' | |
<script> | |
$(document).ready(function () { | |
var height = $(window).height(); | |
var width = $(window).width(); | |
$.ajax({ | |
type: \'POST\', | |
url: \'width.php\', | |
data: { | |
"height": height, | |
"width": width | |
}, | |
success: function (data) { | |
$("body").html(data); | |
}, | |
}); | |
}); | |
</script> | |
'; | |
} | |
echo "<h1>Screen Resolution:</h1>"; | |
?> | |
<?php | |
echo "Width : ".$_POST['width']."<br>"; | |
echo "Height : ".$_POST['height']."<br>"; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment