EN
JavaScript - get browser window size
3 points
In this article, we would like to show you how to get browser window size using JavaScript.
Quick solution:
xxxxxxxxxx
1
var windowWidth = window.outerWidth;
2
var windowHeight = window.outerHeight;
Note:
This solution measures the outer size of the window.
Offset interpretation:

In this section, we present a full example of how to get browser window size.
xxxxxxxxxx
1
2
<html>
3
<body>
4
<script>
5
6
var windowWidth = window.outerWidth;
7
var windowHeight = window.outerHeight;
8
9
console.log('width: ' + windowWidth);
10
console.log('height: ' + windowHeight);
11
12
</script>
13
</body>
14
</html>