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
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
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
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.