Latest web development tutorials

Window innerWidth and innerHeight property

Window Object Reference Window object

Definition and Usage

innerheight return to the document window displays the height of the area.

innerwidth return to the document window displays the width of the area.

Note: Use outerWidth and outerHeight Property Gets plus toolbars and scroll bars of the window width and height.


grammar

Get:

window.innerWidth
window.innerHeight

Setting:

window.innerWidth=pixels
window.innerHeight=pixels


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support innerWidth and innerHeight properties.

Note: IE 8 and earlier versions of IE do not support these two properties.


Examples

Examples

Gets the height and width of the window (does not include toolbars and scroll bars):

var w=window.innerWidth;
var h=window.innerHeight;

try it"


Window Object Reference Window object