kursus
kursus

Reputation: 1404

Iphone access compass in a html page

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

Upvotes: 0

Views: 1140

Answers (2)

kursus
kursus

Reputation: 1404

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.

Upvotes: 0

Dan Morrow
Dan Morrow

Reputation: 4481

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

Upvotes: 1

Related Questions