I've tried various ways of determining the size of the browser's client area in terms of physical pixels, but I get a non-integer result on mobile devices.
For example: window.outerWidth * window.devicePixelRatio
on a Pixel 2 with Chrome yields 1081.5
even though I know that the browser's client area is actually 1080
pixels wide.
Another way of seeing this is going to mydevice.io and multiplying JS screen.width
with JS pixel-ratio
.
Is there a better way to determine physical client size?