function orientationHandler(event) {
    document.getElementById("alpha").innerHTML = event.alpha;
    document.getElementById("beta").innerHTML = event.beta;
    document.getElementById("gamma").innerHTML = event.gamma;
    document.getElementById("heading").innerHTML = event.webkitCompassHeading;
    document.getElementById("accuracy").innerHTML = event.webkitCompassAccuracy;
}

if (window.DeviceOrientationEvent) {
    window.addEventListener("deviceorientation", orientationHandler, false);
} else {
    document.body.innerHTML = "What user agent u r using???";
}