Window outerWidth and outerHeight properties
Window Object
Definition and Usage
The outerHeight property sets or returns the outer height of a window, including all interface elements (such as toolbars/scrollbars).
The outerWidth property sets or returns the outer width of a window, including all interface elements (such as toolbars/scrollbars).
outerWidth and outerHeight are read-only properties.
Note: Use innerWidth and innerHeight properties to get the height and width of the window excluding toolbars and scrollbars.
Syntax
Get the width and height of the window:
window.outerWidth
window.outerHeight
Set the width and height of the window:
window.outerWidth=pixels
window.outerHeight=pixels
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| outerWidth | 1.0 | 9.0 | 1.0 | 3.0 | 9.0 |
| outerHeight | 1.0 | 9.0 | 1.0 | 3.0 | 9.0 |
Example
Example
Get the height and width of the window (including toolbars/scrollbars):
var
w
=
window
.
outerWidth
;
var
h
=
window
.
outerHeight
;
Try it »
The following demonstrates the use of innerWidth, innerHeight, outerWidth, and outerHeight:
Example
var
txt
=
"
"
;
txt
+=
"
innerWidth:
"
window
.
innerWidth
"
"
;
txt
+=
"
innerHeight:
"
window
.
innerHeight
"
"
;
txt
+=
"
outerWidth:
"
window
.
outerWidth
"
"
;
txt
+=
"
outerHeight:
"
window
.
outerHeight
"
"
;
Try it »
Window Object