You are here: Reference > JavaScript > client-side > HTML DOM > properties > innerHeight (window)

innerHeight property (window)

Browser support:
9
Returns the height of the browser's client area, including the horizontal scrollbar, if rendered.
Note: The innerHeight property is supported in Internet Explorer from version 9.
The innerHeight property is rarely useful, because scrollbars are not part of the document working area. Use the cross-browser clientHeight property of the html element instead. It returns the height of the browser's client area without the horizontal scrollbar.
  • You can get the width of the client area, including the vertical scrollbar with the innerWidth property.
  • You can get the width of the client area, excluding the vertical scrollbar with the clientWidth property.
  • The top-left corner of the client area relative to the top-left corner of the screen can be retrieved with the screenLeft and screenTop properties.
  • If you need the total height of the browser window, use the outerHeight property.
  • If you need information about the dimensions of the screen, use the screen object.
  • To get the height of the document or an element in the document, please see the pages for the clientHeight, offsetHeight and scrollHeight properties.

Syntax:

object.innerHeight;
You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

Integer that represents the height, in pixels.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the innerHeight property:
<head>
    <script type="text/javascript">
        function GetClientWindowSize () {
            if ('innerWidth' in window) {   // all browsers, except IE before version 9
                alert ("The width of the client area including the vertical scrollbar: " + window.innerWidth);
            }
            else {  // Internet Explorer before version 9
                alert ("The width of the client area without the vertical scrollbar: " + document.documentElement.clientWidth);
            }
            
            if ('innerHeight' in window) {  // all browsers, except IE before version 9
                alert ("The height of the client area including the horizontal scrollbar: " + window.innerHeight);
            }
            else {  // Internet Explorer before version 9
                alert ("The height of the client area without the horizontal scrollbar: " + document.documentElement.clientHeight);
            }
        }
    </script>
</head>
<body>
    <button onclick="GetClientWindowSize ();">Get the size of the client window</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content