Window outerWidth Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window outerWidth outerHeight

Description

The outerWidth property returns the outer width of a window, including all interface elements (toolbars/scrollbars).

The property is read-only.

Return Value

A Number, representing the outer width of the browser's window, including all interface elements, in pixels

The following code shows how to get the window's height and width

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/* w  w  w .ja  v a 2  s. com*/
    var w = window.outerWidth;
    var h = window.outerHeight;
    document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h;
}
</script>

</body>
</html>

Related Tutorials