Allows you to get the device pixel ratio using JavaScript.
- Author: Tyson Matanich - http://matanich.com
- License: MIT
Currently, getDevicePixelRatio.js
compresses to around 318 bytes (~0.3 KB), after minify and gzip. To minify, you might try these online tools: [Microsoft Ajax Minifier]:(http://ajaxmin.codeplex.com/), [Uglify]:(http://marijnhaverbeke.nl/uglifyjs), [Yahoo Compressor]:(http://refresh-sf.com/yui/), or Closure Compiler. Serve with gzip compression.
<script type="text/javascript">
var devicePixelRatio = window.getDevicePixelRatio();
</script>
GetDevicePixelRatio supports a broad range of browsers and devices (there are currently no known unsupported browsers).