Skip to content

Instantly share code, notes, and snippets.

@sofish
Created November 15, 2010 13:00
Show Gist options
  • Select an option

  • Save sofish/700320 to your computer and use it in GitHub Desktop.

Select an option

Save sofish/700320 to your computer and use it in GitHub Desktop.
function getWH(){
var pageWidth = window.innerWidth,pageHeight = window.innerHeight;
if(typeof pageWidth != "number"){
if(document.compatMode == "CSS1Compat"){
pageWidth = document.documentElement.clientWidth;
pageHeight = document.documentElement.clientHeight;
}else{
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
}
};
return [pageWidth,pageHeight]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment