Skip to content

Instantly share code, notes, and snippets.

@bryanstedman
Created January 11, 2013 05:25
Show Gist options
  • Save bryanstedman/4508166 to your computer and use it in GitHub Desktop.
Save bryanstedman/4508166 to your computer and use it in GitHub Desktop.
Detect retina display with javascript
var retina = window.devicePixelRatio > 1;
if (retina) {
// the user has a retina display
}
else {
// the user has a non-retina display
}
@byte55
Copy link

byte55 commented Apr 17, 2019

When I put the zoom in Chrome to 110%, the window.devicePixelRatio is 1.1
So, this detection is not sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment