Skip to content

Instantly share code, notes, and snippets.

@kylebarrow
Created June 19, 2012 18:50
Show Gist options
  • Save kylebarrow/2955860 to your computer and use it in GitHub Desktop.
Save kylebarrow/2955860 to your computer and use it in GitHub Desktop.
BB10 Alpha viewport test
<!DOCTYPE html>
<html lang="en">
<head>
<title>Screen Test</title>
<meta charset="utf-8">
<!--
Default device width vieport:
BB10 Alpha viewport width = 768px
-->
<!-- <meta name="viewport" content="width=device-width"> -->
<!--
Width 320 vieport:
BB10 Alpha clips screen to 320px.
If viewport includes initial-scale=1.0, default viewport is observed.
-->
<meta name="viewport" content="width=320">
<script type="text/javascript">
if(window.addEventListener) {
window.addEventListener("load",getScreen, false)
}
else if(window.attachEvent) {
window.attachEvent('onload',getScreen)
}
else
{
window.onload = getScreen;
}
function getScreen()
{
var info = "window.outerWidth: " + window.outerWidth
+ "\nwindow.outerHeight: " +window.outerHeight
+ "\nscreen.width: " +screen.width
+ "\nscreen.height: " +screen.height
+ "\nwindow.innerWidth (Viewport): " +window.innerWidth
+ "\nwindow.innerHeight (Viewport): " +window.innerHeight
+ "\ndocument.documentElement.clientWidth: " +document.documentElement.clientWidth
+ "\ndocument.documentElement.clientHeight: " +document.documentElement.clientHeight
+ "\ndocument.body.clientWidth: " +document.body.clientWidth
+ "\ndocument.body.clientHeight: " +document.body.clientHeight
+ "\ndocument.documentElement.scrollWidth: " + document.documentElement.scrollWidth
+ "\ndocument.documentElement.scrollHeight: " + document.documentElement.scrollHeight
+ "\ndocument.body.offsetWidth: " + document.body.offsetWidth
+ "\ndocument.body.offsetHeight: " + document.body.offsetHeight;
document.getElementById('info').innerHTML = info;
}
</script>
<style type="text/css">
#info {
font-family: monospace;
white-space: pre;
}
</style>
</head>
<body>
<div id="info"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment