devicePixelRatioLimited availability
The window.devicePixelRatio property is the ratio of the size of one CSS pixel to the vertical size of one physical pixel on the current display device.
Not yet supported in all major browsers — check the table and provide a fallback.
Browser support
DesktopChrome
1+Supportedsince Dec 11, 2008
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–17Not supported
18+Supportedsince Jan 8, 2013
Current: 157Safari
✕Not supportedup to 27
Current: 27MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155Firefox Android
4–17Not supported
18+Supportedsince Jan 8, 2013
Current: 157Safari iOS
✕Not supportedup to 27
Current: 27How to use
Not supported in Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.
Example
Full syntax and examples are on MDN: devicePixelRatio.
Feature detection
JS · check before using
if ("Window" in globalThis && "devicePixelRatio" in Window.prototype) {
// Window.devicePixelRatio is available
}