Ingamana’s Luciano Borromei explains how device PixelRatio helps you draw more responsively
Device pixel density
First we need to get the pixel density the browser is working at. Luckily there is a DOM property containing that exact value: window.devicePixelRatio. Unfortunately, Internet Explorer 10 for Mobile doesn’t report this value, so a little extra code is required. The JavaScript snippet below allows you to get the value in a way supported by all major up-to-date browsers:
Device pixel density
First we need to get the pixel density the browser is working at. Luckily there is a DOM property containing that exact value: window.devicePixelRatio. Unfortunately, Internet Explorer 10 for Mobile doesn’t report this value, so a little extra code is required. The JavaScript snippet below allows you to get the value in a way supported by all major up-to-date browsers:
view source