Alert height of window

Someone asked on Stack Overflow:

I’m trying to get the height of the window & document to display through an alert and also when a modal window pops up. I know I need to use $(window).height(); & $(document).height(); but other than that I’m not sure what to do.

Edit: The problem that I am trying to solve is that my modal window is adding extra pixels to the bottom of the document so I’m trying to find out the original document height and the height after the modal window is activated.

I posted the following answer, which was chosen as the accepted answer and received 6 upvotes:

Something like this

alert($(window).height());

will show an alert with the height of the window.

Notable comments

Nate (0 upvotes): @Rikudo — OP says: “I’m trying to get the height of the window & document to display through an alert” that is what I answered.


Originally posted on Stack Overflow — 6 upvotes (accepted answer). Licensed under CC BY-SA.

signed letter b

Dad. Geek. Gamer. Software developer. Cloud user. Old Car enthusiast.  Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.