class method document.viewport.getDimensions

View source on GitHub →

document.viewport.getDimensions() → Object

Returns an object containing viewport dimensions in the form { width: Number, height: Number }.

The viewport is the subset of the browser window that a page occupies — the "usable" space in a browser window.

Example
document.viewport.getDimensions();
//-> { width: 776, height: 580 }