How to get the window size in JavaScript

Today we’ll show you how to get the window size in JavaScript. In the previous article, we discussed how to get the screen size in JavaScript.

Get the two different types of the window size

  1. Get the window outer size
  2. Get the window inner size

1. Get the window outer size

window.outerWidth
Gets the width of the outside of the browser window.

window.outerHeight
Gets the height of the outside of the browser window.

Window outer size - Clue Mediator
Window outer size – Clue Mediator

2. Get the window inner size

window.innerWidth
Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.

window.innerHeight
Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.

Window inner size - Clue Mediator
Window inner size – Clue Mediator

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *