title: How to detect page zoom level in all modern browsers?
body: <ol>
  <li><p>How can I detect the page zoom level in all modern browsers? While this <a href="https://stackoverflow.com/questions/680596/how-to-get-zoom-level-in-internet-explorer-7-javascript">thread</a> tells how to do it in IE7 and IE8, I can't find a good cross-browser solution.</p></li>
  <li><p>Firefox stores the page zoom level for future access. On the first page load, would I be able to get the zoom level? Somewhere I read it works when a zoom change occurs <em>after</em> the page is loaded.</p></li>
  <li><p>Is there a way to trap the <code>'zoom'</code> event?</p></li>
  </ol>
  
  <p>I need this because some of my calculations are pixel-based and they may fluctuate when zoomed.</p>
  
  <hr>
  
  <p><strong>Modified sample given by @tfl</strong></p>
  
  <p>This page alerts different height values when zoomed. <a href="http://jsfiddle.net/hjLnG/" rel="noreferrer">[jsFiddle]</a></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"/&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="xy" style="border:1px solid #f00; width:100px;"&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sollicitudin tortor in lacus tincidunt volutpat. Integer dignissim imperdiet mollis. Suspendisse quis tortor velit, placerat tempor neque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent bibendum auctor lorem vitae tempor. Nullam condimentum aliquam elementum. Nullam egestas gravida elementum. Maecenas mattis molestie nisl sit amet vehicula. Donec semper tristique blandit. Vestibulum adipiscing placerat mollis.&lt;/div&gt;
          &lt;button onclick="alert($('#xy').height());"&gt;Show&lt;/button&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>