Window innerHeight Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window innerHeight


The innerHeight property returns the inner height of a window's content area.

The property is read-only.

Return Value

A Number, representing the inner height of the browser window's content area, in pixels

The following code shows how to get the window's height and width:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

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

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

function myFunction() {//from www. j av a m
    var w = window.innerWidth;
    var h = window.innerHeight;
    document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h;


Related Tutorials