JavaScript get the web page size
๐
July 6, 2022
๐JavaScript
In this article, we will show you how to get the web page size in JavaScript.
- JavaScript Math functions
- How To Encode and Decode Strings with Base64 in JavaScript
- How to stash changes in Git
- Detect URLs in text and create a link in JavaScript
- Get the last item in an array using JavaScript
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.