Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
52
rated 0 times [  54] [ 2]  / answers: 1 / hits: 29497  / 13 Years ago, wed, february 15, 2012, 12:00:00

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.


More From » php

 Answers
10
<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



http://jsfiddle.net/sxfv3/


[#87448] Tuesday, February 14, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
minab

Total Points: 701
Total Questions: 104
Total Answers: 91

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;