Skip to content

Instantly share code, notes, and snippets.

@omniosi
Created April 28, 2014 15:35
Show Gist options
  • Save omniosi/11375644 to your computer and use it in GitHub Desktop.
Save omniosi/11375644 to your computer and use it in GitHub Desktop.
cross browser code to get the browser window width and height
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
console.log("browser width = "+x);
console.log("browser height = "+y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment