logicalYDPI property

Gets the normal number of vertical dots per inch (DPI) of the system's screen.



p = object.logicalYDPI


Property values

Type: Integer

The DPI.

Standards information

There are no standards that apply here.


On most systems, there is no difference between horizontal and vertical DPI. The normal DPI on most Windows systems is 96.


The following examples use the logicalYDPI property to retrieve the normal vertical DPI of the screen.

This example uses the deviceYDPI and logicalYDPI properties to calculate the vertical scale factor that a Windows Store app using JavaScript is applying. The function in this example returns 1 if a Windows Store app using JavaScript is not adjusting the scale of the screen.

  function fnScaleFactorY() {
    var nScaleFactor = screen.deviceYDPI / screen.logicalYDPI;
    return nScaleFactor;

This example uses the -ms-zoom property of the BODY element to adjust the scale of the document "manually" if a Windows Store app using JavaScript is not adjusting the scale of the screen and the user's vertical DPI is higher than normal. This is a simple but imprecise way to make a document look the same on higher resolution screens. You can achieve finer control over the layout of your documents by modifying the properties of individual elements or groups of elements.

  // change layout on HighDPI screens when IE not scaling
  function fnScaleManually()
    // normal DPI		
    var constNorm = 96; 
    // scaling is off and DPI higher than normal
    if ((screen.deviceYDPI == screen.logicalYDPI) 
      && (screen.deviceYDPI > constNorm))
      document.body.style.zoom = 
        constNorm / screen.logicalYDPI;				

See also




© 2016 Microsoft