title: Testing hardware support in Javascript for device orientation events of the iPhone 3GS
body: <p>I'm trying to use HTML5 deviceOrientation events in Javascript to rotate an image when the user rotate his iPhone around him.</p>
  
  <p>I use this code to detect when the gyroscope is moving :</p>
  
  <pre><code>window.addEventListener('deviceorientation', function (e) {
      alpha = e.alpha;
      beta = e.beta;
      gamma = e.gamma;            
  }, true);
  </code></pre>
  
  <p>It really works well on iPhone 4+ and iPad 2, but there's no gyroscope on the 3GS (and older iPhones). That's why I'm testing the deviceOrientationSupport like this :</p>
  
  <pre><code>if(window.DeviceOrientationEvent){ // gyroscope support
      alert('DeviceOrientationEvent support OK');
  } else {
      alert('DeviceOrientationEvent support KO');
  }
  </code></pre>
  
  <p>I've seen this code on many websites or forums, but my problem is that with my iPhone 3GS under IOS 5.0.1, this test indicates me : deviceOrientationSupport OK !</p>
  
  <p>I think that this test check only if Safari is able to handle these events :(</p>
  
  <p>So my question is, <strong>is it possible to add a test to know if the hardware can fire orientation events ?</strong></p>
  
  <p>Thanks !</p>