How to get the web page size in JavaScript
In this article, we will show you how to get the web page size in JavaScript.
Recommended Articles:
Checkout more articles on JavaScript
Get the web page size
To get the web page size, we need to get the scrollWidth
and scrollHeight
of the page content.
Use the following code to get the web page size.
1 2 | const pageWidth = document.documentElement.scrollWidth; // Output: 838 const pageHeight = document.documentElement.scrollHeight; // Output: 4110 |
Check the following image for your reference.
I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂