Sometimes, we want to get the size of the screen, current web page, and browser window with JavaScript.
In this article, we’ll look at how to get the size of the screen, current web page, and browser window with JavaScript.
How to get the size of the screen, current web page, and browser window with JavaScript?
To get the size of the screen, current web page, and browser window with JavaScript, we can use various properties.
For instance, we write
window.screen.height;
window.screen.width;
to get the screen’s height and width.
We use
document.body.clientHeight;
document.body.clientWidth;
to get the page’s height and width.
And we use
window.innerHeight;
window.innerWidth;
to get the browser’s height and width.
Conclusion
To get the size of the screen, current web page, and browser window with JavaScript, we can use various properties.