title: Get screen resolution on a mobile website
body: <p>I am designing a mobile website that has a section to download wallpapers from. In order to accommodate many users, I wish to make it possible to download a wallpaper based on the screen resolution. I want to detect resolution from JavaScript and show the appropriate wallpaper.</p>
  
  <p>This is what I found online and tried and failed xD:</p>
  
  <pre><code>width  = window.innerWidth  || document.body.clientWidth
  height = window.innerHeight || document.body.clientHeight;
  </code></pre>
  
  <p>For my SGS3, which has the resolution 720x1280 I get the 360x567.</p>
  
  <p>How should I discover the resolution of the phone from JavaScript?</p>