Calculating zoom using Javascript

2011-02-22 (updated 2012-05-24)

Reading through the responses to the question: “How to detect page zoom level in all modern browsers?”, I made a script to detect zoom on GitHub.

Also, here's a dimensions test page to try in multiple browsers and zoom levels.

Units

Here’s my summary of A pixel is not a pixel is not a pixel on Quirksmode.

Important dimensions from A tale of two viewports