The only way I found till now, is getting the offsetWidth, offsetHeight of a test div
element with height
and width
of one inch:
http://www.infobyip.com/detectmonitordpi.php
Is there a way to detect the screen DPI via JavaScript instead?
Thanks,
Atara.
Advertisement
Answer
<div id='testdiv' style='height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;'></div> <script type='text/javascript'> dpi_x = document.getElementById('testdiv').offsetWidth; dpi_y = document.getElementById('testdiv').offsetHeight; </script>
Then you can use JQuery to send dpi_x
and dpi_y
this to to your server