0

I'd like to get the direction (N/S/E/W) pointed by an iPhone inside a webpage (not an app). Ideally it would be gotten in javascript.

It is likely to be impossible but I would like to be sure. Do you know a way to get this ?

Thank you

kursus
  • 1,396
  • 3
  • 19
  • 35

2 Answers2

1

There's an HTML5 draft spec for this, but seeing as the spec was written just this year, it's doubtful that it's active in Mobile Safari or Webkit yet. http://dev.w3.org/geo/api/spec-source-orientation

Dan Morrow
  • 4,433
  • 2
  • 31
  • 45
0

Actually I found a demo here : http://ariya.ofilabs.com/2011/10/magnetic-compass-via-device-orientation.html

It was successfully tested on iOS 5.

It is said to be supported on iOS < 4.2 too, but a bad implementation of DeviceOrientation makes the magnetic North undetectable.

kursus
  • 1,396
  • 3
  • 19
  • 35