1. Home
  2. Javascript
  3. Window width and height
#javascript#window

You can use 'inner' and 'outer' variants of width and height properties to get the dimensions of the window element. The 'innerWidth' and 'innerHeight' properties capture window sizes excluding scrollbars or toolbars. On the other hand 'outerWidth' and 'outerHeight' properties capture the full area of the browser window including all the panels and scrollbars.

// window size EXCLUDING panels
window.innerHeight;
window.innerWidth;

// window size INCLUDING panels
window.outerHeight; 
window.outerWidth;
copy
Full Javascript cheatsheet
Sitemap Git repository