Is it possible to get a users physical screen size without the use of a physical object or the diagonal measurement?

前端 未结 2 451
旧巷少年郎
旧巷少年郎 2021-02-07 15:26

Question says it all really. I want to be able to display something at actual size, so, for example, if something is displayed in the browser as 20cm, I want to be able to measu

2条回答
  •  清酒与你
    2021-02-07 16:00

    It had been suggested in other places that making a hidden 1" div and then querying the pixel width would get a virtual DPI that you could use to calculate the size by getting the screen width and height in "pixels". I haven't tried this myself yet.

提交回复
热议问题