How to Get Current Screen Size

Learn how to use JavaScript to get the current screen/browser window size.

current screen size

using window.innerWidth and window.innerHeight to get the current screen size of the page.

This example shows the height and width of the browser window (excluding the toolbar/scroll bar):

Example

var w = window.innerWidth;
var h = window.innerHeight;

Try It Yourself

Related Pages

Reference Manual:JavaScript Window Object