The value of screen.height
discussed here can be found at https://www.w3schools.com/jsref/prop_screen_height.asp
To determine if the screen height is less than a certain threshold (in this case 560), I utilized
screen.height < 560 ? true : false
to hide certain UI elements when applicable.
While this method worked effectively in Chrome's mobile device simulator (as shown in the highlighted feature below), https://i.sstatic.net/xGnbH.png
What I mean by "worked effectively" is that when simulating a mobile device, specifically setting the device to iPhone X in landscape mode, the UI elements were hidden correctly based on screen.height < 560 = true
.
However, when testing on a genuine iPhone X, the UI elements did not hide as expected. This discrepancy likely arises from the fact that screen.height < 560 = false
on real devices, even in landscape mode.
I am curious as to why this discrepancy exists... Why does the height of an iPhone X in DevTool differ from that of a real iPhone X?
Could this be due to inaccuracies in Chrome DevTool's simulation? Or perhaps screen.height
does not return the precise value on mobile devices?
Any insights on this matter would be greatly appreciated!