Created
July 22, 2012 20:43
-
-
Save madrobby/3161015 to your computer and use it in GitHub Desktop.
Detect retina support. Tested on iOS, Android 2.x, Chrome for Android, Safari on MacBook Pro Retina, Firefox mobile (beta) for Android, Opera Mobile (Android)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isRetina(){ | |
return (('devicePixelRatio' in window && devicePixelRatio > 1) || | |
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also works on Chrome on MacBook Pro Retina (where
window.devicePixelRatio==2
).