How TO - Get The Current Screen Size


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


Current Screen Size

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

This example displays the browser window's height and width (NOT including toolbars/scrollbars):

Example

var w = window.innerWidth;
var h = window.innerHeight;
Try it Yourself »

Read more about the window object in our JavaScript Window Tutorial.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.