Skip to content

Instantly share code, notes, and snippets.

@grayghostvisuals
Created October 13, 2012 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grayghostvisuals/3882804 to your computer and use it in GitHub Desktop.
Save grayghostvisuals/3882804 to your computer and use it in GitHub Desktop.
Detect hi-dpi screens using Javascript with a fallback to a matchMedia query on Firefox
// Ala Thomas Fuchs : retinafy
function retinaDevice() {
return (('devicePixelRatio' in window && devicePixelRatio > 1) ||
('matchMedia' in window && !matchMedia("(-moz-device-pixel-ratio:1.0)").matches))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment