I am trying to write a program in pure, vanilla JS. I must find the height and width of the window. In JQuery I use .height()
. Online search shows that clientHeight
or innerHeight
is supposed to be the equivalent to height()
however in my program $(widow).height()
and window.innerHeight
console-log different values for both (4500
for height()
and 440
for innerHeight
..and undefined
for window.clientHeight)
How can I find the Vanilla JS equivalent to $(widow).height()
?
innerHeight
is returning a different value thanheight()
, howeverdocument.documentElement.offsetHeight
seems to work. Though the answer says that is for older browsers so I'm wondering why these values are different and if it really is the best solution. – Overbuild