Skip to content

JavaScript outerHeight | Property

  • by

Use JavaScript outerHeight Property to get the outer height of the browser window, including all interface elements (like toolbars/scrollbars). This property is read-only and returns the height in pixels of the whole browser window.

window.outerHeight
//OR
outerHeight

JavaScript outerHeight example

Simple example code.

<!DOCTYPE html>
<html>
<body>
  <script>
    let height = window.outerHeight;
    //OR
    let h = outerHeight;

    console.log('Window Height ',height)
    console.log('Height',h)
  </script>

</body>
</html>

Output:

JavaScript outerHeight Property

More Examples

Get the height and width of the window using window properties:

<!DOCTYPE html>
<html>
<body>

  <div id="demo"></div>

  <script>
    let text =
    "<p>innerWidth: " + window.innerWidth + "</p>" +
    "<p>innerHeight: " + window.innerHeight + "</p>" +
    "<p>outerWidth: " + window.outerWidth + "</p>" +
    "<p>outerHeight: " + window.outerHeight + "</p>";

    document.getElementById("demo").innerHTML = text;
  </script>

</body>
</html>

Output:

innerWidth: 1461

innerHeight: 515

outerWidth: 1475

outerHeight: 878

Do comment if you have any doubts or suggestions on this JS 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

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading