How to get the height of device screen in JavaScript ? Last Updated : 12 Jul, 2025 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 width 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 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 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 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 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 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 Like