Javascript Browser Screen availHeight Property

Introduction

Get the available height of your screen:

var x = "Available Height: " + screen.availHeight;

Click the button to display the available height of your screen.

View in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from  w  w w  . j a v a2s.  c om*/
  var x = "Available Height: " + screen.availHeight + "px";
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

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

The availHeight property returns a Number representing the height of the user's screen, in pixels.




PreviousNext

Related