Created
July 30, 2012 02:39
-
-
Save jacoborus/3203619 to your computer and use it in GitHub Desktop.
Get browser screen resolution all platforms
This file contains 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
// 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