I'm creating a web application for displaying ECGs, which are conventionally drawn at fixed scales (10 mm/mV and 25 mm/s) on a 5mm square grid. It's important to use the correct size, because readers compare what they see on-screen with other ECGs that may exist only on paper.
The most recommended solution is to use CSS to style a div such that it has absolute dimensions of (say) 1" by 1", and to use JavaScript to obtain its height and width (see, for example, How to detect the screen DPI using PHP or JavaScript). Obviously, this can work only if the browser knows (or can discover) the answer and can be tricked into revealing it. I tested this method on Linux, Mac OS X, and Windows, using Chrome, Firefox, MSIE, Opera, Safari, and the Android browser on devices ranging from a smart phone (217 dpi) to 19" (108 dpi), 20", and 30" (101 dpi) monitors, and in all cases the reported resolution was 96 dpi. My conclusion is that this approach is less accurate than a broken watch, unless you happen to have a 96 dpi monitor, and I'm looking for something better.
I'm thinking of just displaying a resizable rectangle and asking the user to adjust it to a known size. Has anyone already done this (and if so, how), or does anyone have an alternative suggestion (such as looking up the screen size in a database of monitors)?
I have read related discussions here and elsewhere that quickly turn to the reasons why the absolute size of graphics doesn't matter, only the amount of detail. I understand why this is often true, but it is not so in this case.