Skip to content

Window height JavaScript | Property

  • by

Using window.innerHeight property you can get the current screen height of the page in JavaScript. This will fetch the browser window’s height (NOT including toolbars/scrollbars).

window.innerHeight; 

For screen size, you can use the screen object:

window.screen.height;
//window.screen.width;

Example Window height JavaScript

Simple example code.

<!DOCTYPE html>
<html>
<body>
  <script>
    var sh = screen.height;
    var wh = window.innerHeight;

    console.log('Window Height ',sh)
    console.log('Screen size',wh)
  </script>

</body>
</html>

Output:

Window height JavaScript

The screen.availHeight property returns the height of the visitor’s screen, in pixels, minus interface features like the Windows Taskbar.

Do comment if you have any doubts or suggestions on this Js window object property topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *