title: HTML 5 Mobile Device Orientation API: Alpha (compass) value does not indicate north
body: <p>The alpha value in the following snippet of code should variate between 0 and 360 according to the device's rotation:</p>
  
  <pre><code>window.addEventListener('deviceorientation', function(eventData) {
      var LR = eventData.gamma;
      var FB = eventData.beta;
      var DIR = eventData.alpha;
  
      deviceOrientationHandler(LR, FB, DIR);
  });
  </code></pre>
  
  <p>This variation should depend on the wind direction it's facing. To accomplish this the device utilises a magnetometer / compass. </p>
  
  <p>When i tested this on an ipad 3 i encountered the following problem:</p>
  
  <p>It varies from 0 to 360, but in a relative way. The page shows 0 when loaded and then varies between 0 and 360. But when the device is rotated and the page is refreshed it again starts by showing 0 and then varying between those values. </p>
  
  <p>As it should follow wind directions and i am trying to find out where the North is i need it to do this in an absolute way instead of a relative way. AKA: always display the same value when facing somewhere regardless of when and in what direction the device is facing when the page is loaded. </p>
  
  <p>These scources indicate the API should be capable of this:</p>
  
  <p><a href="http://www.html5rocks.com/en/tutorials/device/orientation/" rel="nofollow">html5rocks</a></p>
  
  <p>And this one: </p>
  
  <p><a href="http://dev.w3.org/geo/api/spec-source-orientation.html" rel="nofollow">W3C</a></p>
  
  <p>And here's an example where "direction" should be 0 when facing north (or at least return a consistent value):</p>
  
  <blockquote>
    <p>the html5rocks page contains an example (ctrl + f and "try it out").
    Can't post more then 2 URLS</p>
  </blockquote>
  
  <p>Is this the correct way of indicating the wind direction the device is facing? I need to use this in combination with the Google Maps Api.</p>
  
  <p>And lastly i know there are compass apps for the Ipad 3 so the device should be capable of doing this.</p>
  
  <p>I am confused :)</p>