How to get the height of device screen in JavaScript ? Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue 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 ? Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 23 Jan, 2023 Like Article Save Article Previous How to iterate an Array using forEach Loop in JavaScript? Next How to restrict input box to allow only numbers and decimal point JavaScript? Share your thoughts in the comments Add Your Comment Please Login to comment...