Window.devicePixelRatio

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

La propiedad de sólo-lectura Window.devicePixelRatio retorna la relación de tamaño (vertical) de un pixel físico en el dispositivo de visualización actual respecto del de un dispositivo de tamaño de pixel independiente (dips).

No hay retrofunciones o eventos a escuchar cuando este valor cambia (por ejemplo, si usted arrastra la ventana entre displays con diferentes densidades de pixels).

Sintaxis

js
value = window.devicePixelRatio;

Especificaciones

Specification
CSSOM View Module
# dom-window-devicepixelratio

Compatibilidad con navegadores

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
devicePixelRatio

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support

Ver también