title: Getting wrong window height in chrome
body: <p>I'm trying to get the correct width and height of the browser window in Chrome. The size is correct in Firefox, I have not tried any other browsers.</p>
  <p>I have set the doctype to <code>!DOCTYPE html</code> and have tried <code>$( window ).height()</code>, <code>$( window ).width()</code>, <code>window.innerHeight</code> and <code>window.innerWidth</code>, but all of them give the wrong values.</p>
  <p>I'm running openSuse tumbleweed and the version of chrome is &quot;Version 86.0.4240.75 (Official Build) (64-bit)&quot;</p>
  <p>Updated chrome to &quot;Version 87.0.4280.88 (Official Build) (64-bit)&quot; this did not help either, still the wrong size.</p>
  <p>I have included a couple in images that show this, NOTICE: the DOMRect values are not correct in chrome but are correct in firefox. Sorry, you may need to zoom in to see the values. Below is what I'm logging in the two images.</p>
  <pre><code>console.log(
      $('#primary')[0].getBoundingClientRect(),
      $( window ).width(),
      window.innerWidth,
      $( window ).height(),
      window.innerHeight
  )
  </code></pre>
  <p>I need precise sizes as to have things line up correctly. You can see in the firefox image below the background colour &quot;red&quot; just above the horizontal scrollbar. I need to know the correct dimensions of the window
  so I can do the math and make things line up.</p>
  <p>Is there another way more accurate to do this?</p>
  <p><a href="https://i.stack.imgur.com/RDNoL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RDNoL.png" alt=" Wrong size in chrome. " /></a></p>
  <p><a href="https://i.stack.imgur.com/eLux4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eLux4.png" alt="Right size in firefox " /></a></p>
  <p>The image below is what I got from the JSFiddle suggested in the comment below form &quot;FSDford&quot;. You can see in the console the size 877 in red &quot;need to zoom in to see it&quot;. The ruler says its width is 856 though!
  Once again Firefox has the correct width.</p>
  <p><a href="https://i.stack.imgur.com/klyrQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/klyrQ.png" alt="JSFiddle wron size " /></a></p>
  <p><a href="https://i.stack.imgur.com/A5bWX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A5bWX.png" alt="JSFiddle right size" /></a></p>