Detect zoom level using Javascript
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 71 commits behind tombigel:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tools
README.md
detect-zoom.js
test-page.html

README.md

Javascript Zoom Detector

Detect the zoom level of the user's browser using Javascript. This can be used to show higher-resolution canvas or img when necessary.

It may not be complete; I need help testing different browsers. Patches welcome.

Usage:

<script src=detect-zoom.js></script>
<script>
  var zoom = DetectZoom.zoom();
  
  console.log(zoom);
</script>

Demo

Dimensions test

License

Detect-zoom is dual-licensed under the WTFPL and MIT license, at the recipient's choice.