Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tysonmatanich/GetDevicePixelRatio
An easy way to get the device pixel ratio of a screen using JavaScript.
https://github.com/tysonmatanich/GetDevicePixelRatio
Last synced: 3 days ago
JSON representation
An easy way to get the device pixel ratio of a screen using JavaScript.
- Host: GitHub
- URL: https://github.com/tysonmatanich/GetDevicePixelRatio
- Owner: tysonmatanich
- Created: 2012-11-02T22:13:38.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-04-24T17:15:58.000Z (over 7 years ago)
- Last Synced: 2024-11-03T06:11:59.293Z (11 days ago)
- Language: JavaScript
- Size: 49.8 KB
- Stars: 76
- Watchers: 7
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GetDevicePixelRatio
Allows you to get the device pixel ratio using JavaScript.
* Author: Tyson Matanich - http://matanich.com
* License: MIT## Size and delivery
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](http://closure-compiler.appspot.com/home). Serve with gzip compression.
## Sample
```html
var devicePixelRatio = window.getDevicePixelRatio();
```
## Support
GetDevicePixelRatio supports a broad range of browsers and devices (there are currently no known unsupported browsers).