title: Why isn't window.innerWidth returning the right value?
body: <p>I am trying to solve the problem of using Javascript to determine the width of my browser's "window". I'm aware different people can mean different things in this context so to be specific I mean the area in green as in <a href="https://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript">this</a> post.</p>
  
  <p>I've read the first two replies to that post and a number of other stackoverflow solutions to this problem, none of which I could get to work: I am using Firefox 27.0.1 with the window maximised on a monitor that is 1920 pixels wide. The scripts says my viewport is 1536 pixels wide. I expected 1920 (or something close).</p>
  
  <p>Based on what I have seen, it seemed to me the simplest solution in my case was this code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function onAfterLoad() {
      document.write('&lt;p&gt;Your viewport width is '+window.innerWidth+'&lt;/p&gt;');
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onAfterLoad();"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>At the time of writing this code is <a href="http://www.kilgore.org.uk/surfing/fixed3.html" rel="nofollow noreferrer">here</a>. This also says my viewport is 1536 pixels wide when I think it should be 1920.</p>
  
  <p>Where am I going wrong please?</p>