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:
var windowWidth = window.outerWidth;
var windowHeight = window.outerHeight;
Note:
This solution measures the outer size of the window.
Offset interpretation:

Practical example
In this section, we present a full example of how to get browser window size.
// ONLINE-RUNNER:browser;
<!doctype html>
<html>
<body>
<script>
var windowWidth = window.outerWidth;
var windowHeight = window.outerHeight;
console.log('width: ' + windowWidth);
console.log('height: ' + windowHeight);
</script>
</body>
</html>