Skip to content

Instantly share code, notes, and snippets.

@msreddy09
Created December 31, 2012 12:38
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 msreddy09/4419471 to your computer and use it in GitHub Desktop.
Save msreddy09/4419471 to your computer and use it in GitHub Desktop.
I am not getting correct device pixel ratio in FF of mobile devices
var ratio = window.devicePixelRatio ||
(function(i){
var wmq = window.matchMedia;
while( !window.devicePixelRatio && i > 0 &&
!wmq("(min--moz-device-pixel-ratio:" + i/10 + ")").matches ){
i=i-1;
}
return i/10;
})(30);
I used the above code to getting the result, But it fails in Firefox browser.
@msreddy09
Copy link
Author

var ratio = window.devicePixelRatio ||

(function(i){

var wmq = window.matchMedia;

while( !window.devicePixelRatio && i > 0 &&

!wmq("(min--moz-device-pixel-ratio:" + i/10 + ")").matches ){

i=i-1;

}

return i/10;

})(30);

I used the above code to getting the result, But it fails in Firefox browser.

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