DOM:window.innerWidth
From MDC
Contents |
[edit] Summary
Width of the browser window viewport including, if rendered, the vertical scrollbar.
[edit] Syntax
var intViewportWidth = window.innerWidth;
[edit] Value
intViewportWidth stores the window.innerWidth property value.
The window.innerWidth property is read-only; it has no default value. window.innerWidth property stores an integer representing a number of pixels.
[edit] Notes
The innerWidth property does not include the sidebar. So when the sidebar is expanded, the innerWidth property value diminishes.
The innerWidth property will be supported in any window object like a window, a frame, a frameset or a secondary window.
[edit] Example
Assuming a frameset
---------------------
var intFrameWidth = window.innerWidth; // or var intFrameWidth = self.innerWidth; /* will return the width of the frame viewport within the frameset */ var intFramesetWidth = parent.innerWidth; /* will return the width of the viewport of the closest frameset */ var intOuterFramesetWidth = top.innerWidth; /* will return the width of the viewport of the outermost frameset */
xxx To do: link to an interactive demo here xxx
See also window.outerWidth, window.innerHeight and window.outerHeight.
[edit] Standards information
DOM Level 0. Not part of any W3C technical specification or recommendation.