Get window size, width, height in JavaScript

Description

The following code shows how to get window size, width, height.

Example


<!--  ww  w .  ja v a2s.c om-->

<!DOCTYPE HTML>
<html>
<body>
<script type="text/javascript">
document.writeln(window.outerWidth);
document.writeln(window.outerHeight);
document.writeln(window.innerWidth);
document.writeln(window.innerHeight);
document.writeln(window.screen.width);
document.writeln(window.screen.height);
</script>
</body>
</html>

Click to view the demo

The code above generates the following result.

Get window size, width, height in JavaScript