Skip to content

Instantly share code, notes, and snippets.

@fencermonir
Created August 16, 2018 08:51
Show Gist options
  • Save fencermonir/db63a34bd9b1e70a6265e0b7c1f96f97 to your computer and use it in GitHub Desktop.
Save fencermonir/db63a34bd9b1e70a6265e0b7c1f96f97 to your computer and use it in GitHub Desktop.
Find Retina Display
function isRetinaDisplay() {
if (window.matchMedia) {
var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");
return (mq && mq.matches || (window.devicePixelRatio > 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment