How to get the height of device screen in JavaScript ? Last Updated : 23 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Given an HTML document which is running on a device. The task is to find the height of the working screen device using JavaScript. Prerequisite - How to get the width of device screen in JavaScript ? Example 1: This example uses window.innerHeight property to get the height of the device screen. The innerHeight property is used to return the height of the device. html <h1 style="color:green;"> GeeksforGeeks </h1> <p id="GFG_UP"></p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN"></p> <!-- Script to display the device screen Height --> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); el_up.innerHTML = "Click on the button to get the" + " Height of the device's screen"; function GFG_Fun() { var Height = window.innerHeight; el_down.innerHTML = Height + " pixels"; } </script> Output: How to get the height of device screen in JavaScript ? Example 2: This example uses document.documentElement.clientHeight method to get the Height of the device screen. html <h1 style="color:green;"> GeeksforGeeks </h1> <p id="GFG_UP"></p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN"></p> <!-- Script to display the device screen Height --> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); el_up.innerHTML = "Click on the button to get the" + " Height of the device's screen"; function GFG_Fun() { el_down.innerHTML = document.documentElement.clientHeight + " pixels"; } </script> Output: How to get the height of device screen in JavaScript ? Comment More infoAdvertise with us Next Article How to get the height of device screen in JavaScript ? S SHUBHAMSINGH10 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to get the width of device screen in JavaScript ? Given an HTML document that is running on a device and the task is to find the width of the working screen device using JavaScript. Example 1: This example uses window.innerWidth to get the width of the device screen. The innerWidth property is used to return the width of the device. HTML<!DOCTYP 2 min read How to get the height of scroll bar using JavaScript ? To get the height of scroll bar we could use different approaches. In this article, we are given an HTML document and the task is to get the height of the scrollbar using JavaScript. Following are the different approaches to solving this problem which are discussed below: Table of Content Using Cont 3 min read How to get the div height using JavaScript ? In this article, we will see How to get the div height using Javascript. We can do this by following ways: Using the offsetHeight property.Using the clientHeight property.Using getBoundingClientRect() Method. Method 1: Using the offsetHeight property: The offsetHeight property of an element is a rea 3 min read How to get the diagonal length of the device screen using JavaScript ? Knowing the width and height of a browser window helps a web developer to enhancing the user experience. It can help in improving browser animations and the relative positioning of divisions and containers. Javascript provides a window object that represent an open browser window. It provides the va 3 min read How to get the Element's Actual Width and Height in JavaScript? In JavaScript, it is often necessary to retrieve the actual width and height of an HTML element. This information can be useful in a variety of scenarios, such as setting the size of an element dynamically, centering an element on the page, or determining the size of an element for animation purpose 5 min read Like