--- title: Window.innerHeight slug: Web/API/Window/innerHeight translation_of: Web/API/Window/innerHeight ---
Altura (em pixels) da janela de visualização do navegador, incluindo, se renderizado, a barra de rolagem horizontal.
var intViewportHeight = window.innerHeight;
On return, intViewportHeight
is the height of the browser window's viewport.
The window.innerHeight
property is read only; it has no default value.
The innerHeight
property is supported in any window object like a {{domxref("window")}}, a frame, a frameset, or a secondary window.
There is an algorithm to obtain the height of the viewport excluding, if rendered, the horizontal scrollbar.
var intFrameHeight = window.innerHeight; // or var intFrameHeight = self.innerHeight; // will return the height of the frame viewport within the frameset var intFramesetHeight = parent.innerHeight; // will return the height of the viewport of the closest frameset var intOuterFramesetHeight = top.innerHeight; // will return the height of the viewport of the outermost frameset
{{todo("link to an interactive demo here")}}
To change the size of a window, see {{domxref("window.resizeBy()")}} and {{domxref("window.resizeTo()")}}.
To get the outer height of a window, i.e. the height of the whole browser window, see {{domxref("window.outerHeight")}}.
The following figure shows the difference between outerHeight
and innerHeight
.
Specification | Status | Comment |
---|---|---|
{{SpecName('CSSOM View', '#dom-window-innerheight', 'window.innerHeight')}} | {{Spec2('CSSOM View')}} | Initial definition |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1 | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(1.0)}}[1] | 9 | 9 | 3 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 1 | {{CompatVersionUnknown}} | {{CompatGeckoMobile(1.0)}}[1] | 9 | 9 | 3 |
[1] From Firefox 4 to 24 this property was buggy and could give a wrong value before page load on certain circumstances, see {{bug(641188)}}.