Getting the Max Viewable Web Page Size

window.innerHeight; // returns browser view port height in pixels window.innerWidth; // returns browser view port width in pixels

The window object provides the innerHeight and innerWidth of the browser window. These values represent the actual pixels in the browser window that the web page will be displayed within. This is a critical piece of information if you need to adjust the size and location of elements on the web page based on the actual area that is being displayed.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.