How to get screen's physical size (i.e. in inches)?

后端 未结 2 331
星月不相逢
星月不相逢 2020-12-10 02:53

I\'m trying to figure out how to get the physical dimensions of a device\'s screen via Javascript. So far, my conclusion is that it\'s currently impossible, but I hope someo

相关标签:
2条回答
  • 2020-12-10 03:15

    Take a look at this post. It's done with:

    <meta name="viewport" content="width=device-width, target-densitydpi=device-dpi">
    
    0 讨论(0)
  • 2020-12-10 03:26

    96 "DPI" is a web standard that has little to do with reality. The inches it measures are best considered "logical" inches, which correspond to font metrics and CSS measurements (which can include points and inches). A "point" in typography is defined to be 1/72 inch, but screens stopped being consistently 72 DPI ages ago. Thus, all a CSS point really means now is that a 96 point font is 72 pixels tall. (And that's logical pixels, since the issue is now further conflated by hi-DPI screens.)

    Anyhow, most native operating systems don't know a thing about their true physical screen size, so they don't even have information about such that they could expose to web apps via a browser. What you're asking isn't possible.

    0 讨论(0)
提交回复
热议问题