title: Detect virtual keyboard vs. hardware keyboard
body: <p>I have been thinking about this a while now, and I can't figure a way to deal with it. Is there any way to detect if the user uses a virtual (software) keyboard or a traditional (hardware) keyboard?</p>
  
  <p>The new Windows Surface has its own keyboard in the cover, and for Android / iPad there are a ton of different bluetooth keyboards.</p>
  
  <p>So, do any of you have any input about this?<br>
  I'm aiming for Android, IOS &amp; Windows Tablet/Phone.</p>
  
  <hr>
  
  <p><strong>Motivation:</strong> (very subjective)</p>
  
  <p>When developing web applications for tablet/smartphone I have come to the understanding that it's easier - in many situations - to use a JavaScript keyboard instead of the OS's software keyboard.</p>
  
  <p>Lets say you want to enter a PIN code. Instead of having a keyboard filling half of the screen:</p>
  
  <p>Software (OS) keyboard:</p>
  
  <pre><code>|----------------|
  |    [ input]    |
  |                |
  |----------------|
  |  1  2  3  4  5 |
  |  6  7  8  9  0 |
  |----------------|
  </code></pre>
  
  <p>JavaScript keyboard:</p>
  
  <pre><code>|----------------|
  |    [ input]    |
  |    | 1 2 3|    |
  |    | 4 5 6|    |
  |    |_7_8_9|    |
  |                |
  |                |
  |----------------|
  </code></pre>
  
  <p>If you need to handle a lot of inputs, maybe you want to make an overlaying <code>div</code> with the inputs and use the software keyboard:</p>
  
  <pre><code>|----------------|
  | P1 P2    P3 P4 |
  | [inp 1][inp 2] |
  |----------------|
  |    KEYBOARD    |
  |                |
  |----------------|
  </code></pre>
  
  <p>But if the user has their own hardware keyboard, we want to make the edit inline in place.</p>
  
  <hr>
  
  <p>I have been looking around SO and found  this post: <a href="https://stackoverflow.com/questions/2593139/ipad-web-app-detect-virtual-keyboard-using-javascript-in-safari">iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?</a> ... but this seams to only work in IOS - not sure about browser.</p>