Get Chrome Browser Height or Nav/Menu/Toolbars Height

Viewed 4456

How do we get the actual browser height of a Chrome Browser window? In my testing, if the browser is not using the full height available I am having a hard time calculating its actual height with Javascript.

For the purpose of my example, my browser window has a height of 1033px. There are 7px separating the bottom of the Chrome Browser Window and the Windows Toolbar.

I am unable to figure out a way to calculate the actual height of 1033px from Javascript. If I knew the Nav/Menu/Toolbars Height (109px in my example) I could figure the height out.

 1040px (screen.availHeight)
- 109px (Nav/Menu Toolbars Height)
-   1px (bottom border)
- 923px (window.innerHeight)
-------
    7px (Height Pixels not used by Browser)

1040px - 7px = 1033px (Browser Actual Height)

Nav/Menu/Toolbars Height: 109px
Browser Height: 1033px
Windows Toolbar: 40px

Values from Javascript:
Screen Size: 1080px
screen.height = 1080
screen.availHeight = 1040
window.outerHeight = 1040
window.innerHeight = 923
$(window).height() = 923

Are there any Javascript methods to obtain either the Navigation Menu's Height or the actual Height of the Chrome Browser Window?

Below is an example image of what I am trying to calculate. enter image description here

1 Answers
Related