Clue Mediator

How to get the web page size in JavaScript

πŸ“…June 29, 2021
πŸ—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.

const pageWidth  = document.documentElement.scrollWidth; // Output: 838
const pageHeight = document.documentElement.scrollHeight; // Output: 4110

Check the following image for your reference.

Web page size - Clue Mediator

Web page size - Clue Mediator

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! πŸ™‚