window.innerHeight Property Javascript DOM Share / Like
The innerHeight, innerWidth, outerHeight and outerWidth properties will return numeric values that represent the browser and document window. The outer dimensions represent the actual browser software window, while the inner dimensions represent the document window nested inside the browser window.
In this example we will access the browser window dimensions as well as the document window dimensions. Repeatedly resize your browser window and press the button to see numbers change.
Javascript CODE EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function getWindowInnerSize(){
var h = window.innerHeight;
var w = window.innerWidth;
alert("Inner is "+h+" pixels in height and "+w+" pixels in width");
}
function getWindowOuterSize(){
var h = window.outerHeight;
var w = window.outerWidth;
alert("Outer is "+h+" pixels in height and "+w+" pixels in width");
}
</script>
</head>
<body>
<button onclick="getWindowInnerSize()">Get Window Inner Size</button>
<button onclick="getWindowOuterSize()">Get Window Outer Size</button>
</body>
</html>