Skip to content

Instantly share code, notes, and snippets.

@jacoborus
Created July 30, 2012 02:39
Show Gist options
  • Save jacoborus/3203619 to your computer and use it in GitHub Desktop.
Save jacoborus/3203619 to your computer and use it in GitHub Desktop.
Get browser screen resolution all platforms
// http://www.digimantra.com/technology/javascript/detect-screen-or-browser-size-in-javascript/
function getWidth()
{
xWidth = null;
if(window.screen != null)
xWidth = window.screen.availWidth;
if(window.innerWidth != null)
xWidth = window.innerWidth;
if(document.body != null)
xWidth = document.body.clientWidth;
return xWidth;
}
function getHeight() {
xHeight = null;
if(window.screen != null)
xHeight = window.screen.availHeight;
if(window.innerHeight != null)
xHeight = window.innerHeight;
if(document.body != null)
xHeight = document.body.clientHeight;
return xHeight;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment