title: windows 8 metro style app - find mouse or touch based execution
body: <p>I am creating one app for Windows 8 Metro style app using HTML 5 and JavaScript. I require to find at launch of the app whether it will be touch base process or mouse based process (smartphone or desktop computer).</p>
  
  <p>I tried following things.</p>
  
  <p>1)  As per following,
  <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.pointerdevicetype.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.pointerdevicetype.aspx</a></p>
  
  <p>but we are not sure what to pass in as “pdt” in function getPointerDeviceType(pdt)</p>
  
  <p>Tried various things but it return me “undefined” only.</p>
  
  <p>2)  We tried Modernizr js framework to find for following code</p>
  
  <pre><code>    if (Modernizr.touch){
         // bind to touchstart, touchmove, etc and watch `event.streamId`
      } else {
         // bind to normal click, mousemove, etc
      } 
  </code></pre>
  
  <p>But when we insert the latest js code of “Modernizr”, it gives us security error for appendchild command. Something like 
  “0x800c001c - JavaScript runtime error: Unable to add dynamic content.”</p>
  
  <p>Can anyone please tell how we can achieve so that based on condition, we can execute code for touch based and mouse based execution of app.</p>