Hi guys I have a page that I want to set the initial zoom a little lower on smaller screen sizes, the problem is that I can't get the screen size within javascript, I need to zoom out on screens between 13 and 14 inches but there is no logical way to get that from the pixel values
I have the same problem on mobile, on certain phones the page looks good but on others it doesn't, instead of rebuilding everything I just wanna zoom out
I know it might be bad practice but if there is a way to do it that's what I wanna do
Inspired by what bZezzz wrote, but with some code to retrieve actual screen dimensions. Also note that screen.availHeight and screen.availWidth return the screen size, and might not be that helpful if your page is being rendered on only a part of the screen.
let hypotenuse = Math.sqrt(screen.availHeight**2 + screen.availWidth**2)
console.log(
'pixels', hypotenuse,
'inches', hypotenuse / 96 // Per spec, there are 96 pixels per inch
);