View Full Version : Javascript buttons and screen DPI

07-07-2005, 04:04 PM
I finished a script on one pc and tested it and it was working fine(96dpi). However when i tried it on another computer where the screen was set to 125dpi, the layout was completely mucked up. The text areas and buttons were too big. Is it possible to somehow make my script completely unaffected by the DPI of the users computer? Or if thats not possible, can i detect the DPI of a users screen so i can then redirect them to a version created for them? Thanks for reading.

07-07-2005, 04:17 PM
just change your CSS. JS scripts are not effected by screen resolution per se, but the HTML layouts which might be generated by them might be themselves. for this reason, the solution lies in better CSS, not in the JS itself.

07-07-2005, 09:02 PM
Related: Adjusting Scale for Higher DPI Screens (http://msdn.microsoft.com/workshop/author/dhtml/overview/highdpi.asp)

Otherwise, style an element to "1in" x "1in", and check its offsetWidth & offsetHeight properties (to get x & y DPI), I guess...