Created
March 14, 2013 09:43
-
-
Save tieleman/5160086 to your computer and use it in GitHub Desktop.
Quick 'n dirty script to report viewport sizes. See #5159984 for a list of devices.
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> | |
<head> | |
<title>viewport test</title> | |
<meta name="viewport" id="viewport" content="width=device-width"> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<span id="width"></span> x <span id="height"></span> | |
<script type="text/javascript"> | |
(function() { | |
function calculate() { | |
for (var i=0; i<2560; i++) { | |
document.getElementById("width").innerText = i; | |
if (window.matchMedia("screen and (max-width: " + i + "px)").matches) { | |
break; | |
} | |
} | |
for (var i=0; i<2560; i++) { | |
document.getElementById("height").innerText = i; | |
if (window.matchMedia("screen and (max-height: " + i + "px)").matches) { | |
break; | |
} | |
} | |
} | |
calculate(); | |
window.onorientationchange = calculate; | |
window.onresize = calculate; | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://gist.github.com/tieleman/5159984 for a list of devices and their reported sizes.