Detect Physical dimension of Monitor

此生再无相见时 提交于 2019-12-10 16:08:43

问题


I want to get the display dimensions of my monitor.

Is it possible to do with JavaScript or Flash?

I tried the following function:

var dpi_x = document.getElementById('testdiv').offsetWidth;
        var dpi_y = document.getElementById('testdiv').offsetHeight;
        var width_in = screen.width / dpi_x;
        var height_in = screen.height / dpi_y;
        var diagonal_in = Math.round(10 * Math.sqrt(width_in * width_in + height_in * height_in)) / 10;

but it doesn't show the fixed diagonal value... because when I change the resolution of the display...

Where as I want the fixed dimension like 16.5"... I mean, it should be fixed for any specific monitor..


回答1:


It's not possible to detect the physical dimensions. Resolution is as close as you're gonna get.



来源:https://stackoverflow.com/questions/12051071/detect-physical-dimension-of-monitor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!