Is it possible to access the compass with Javascript on an iphone/ android device from a web app? Have been looking all over the net for hours I know you can access the accelerometer with
window.ondevicemotion = function(event)
Does anyone know if you can access the information from the compass??
On iPhone, you can get the compass value like this.
window.addEventListener('deviceorientation', function(e) {
console.log(e.webkitCompassHeading);
}, false);
Hope this help.