Javascript Reference - Screen availHeight Property








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

Browser Support

availHeight Yes Yes Yes Yes Yes

Syntax

screen.availHeight

Return Value

Type Description
Number The height of the user's screen, in pixels




Example

The following code shows how to get the available height of your screen.


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<!--from  w  w  w.  j av  a2 s .c  o m-->
<p id="demo"></p>

<script>
function myFunction() {
    var x = "Available Height: " + screen.availHeight + "px";
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows:





More Examples

All screen properties


<!DOCTYPE html>
<html>
<body>
<div id="demo"></div>
<!--   w  w w .  ja  v a2  s  .c  o m-->
<script>
var txt;
txt = "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>";
txt+= "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight + "</p>";
txt+= "<p>Color depth: " + screen.colorDepth + "</p>";
txt+= "<p>Color resolution: " + screen.pixelDepth + "</p>";

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

</body>
</html>

The code above is rendered as follows: