title: javascript detect desktop touch and mouse support
body: <p>How should touch-enabled devices be differentiates between pure touch and ones that also have a mouse? (like some of today's laptops)</p>
  
  <p>There is a need to give all mouse functionality a priority in an application, and if the device running the app has only touch support, to change the functionality. </p>
  
  <p>If a touch-device also has a mouse pointer, logic suggests the app should consider that device as a normal desktop, and might add touch support as well, but the styling itself should respond to mouse events.</p>
  
  <p>normal touch detection is achieved like so:
  <code>'ontouchend' in document;</code></p>
  
  <p>One way to detect if the computer is desktop might be to check the screen resolution:</p>
  
  <pre><code>window.screen.width &gt;= 1280 // desktop 
  </code></pre>
  
  <p>but that is not so good because some devices might have very large <strong>viewport</strong> resolution, and some laptops might have low resolution...</p>