Skip to content Skip to sidebar Skip to footer

Get Height Of Page Content

I am trying to get the height of the body of a webpage. I want it to be the value of when the page is loaded on an HD screen at 100% zoom. The point of this is to then change the v

Solution 1:

The problem is that you have a high pixel density phone that renders the web page at an increased pixel ratio. Divide height by window.devicePixelRatio to account for this.

Note: I don't think your method of getting the height is particularly ideal. Instead of just picking the biggest of like 5 values, you should just use one value. Perhaps window.innerHeight would do the trick?


Post a Comment for "Get Height Of Page Content"