3

Does anyone know how to find the compass heading of an iOS device from within a web app? The new Device Orientation APIs supported in iOS 4.2 only seem to provide relative changes in rotation. Was anyone able to find a workaround to this? (I also get a null value for the coords.heading property when using navigator.geolocation.)

Matt
  • 1,710
  • 3
  • 14
  • 15

1 Answers1

0

Compass support is available in the devicemotion event through new attributes: webkitCompassHeading and webkitCompassAccuracy. There is also a new event we can subscribe to: compassneedscalibration. This will work only on iPad 2, iPhone 4, 4S and iPod touch last generation.

source: http://www.mobilexweb.com/blog/ios-5-iphone-and-ipad-html5

alternatively: Access device compass from webb app with Javascript

Community
  • 1
  • 1
Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69