Peter Westendorp



Coding

Accelerometer support in browsers

The presentation Paul Irish did on Fronteers 2010 inspired me to look into accelerometer support in current browsers. I found out Firefox already supports accelerometers since version 3.6. To get the data from the accelerometer you just have to listen to the orientation event:

window.addEventListener("MozOrientation", handleOrientation, true);

Paul Irish showed in his presentation that Chromium now supports it as well. For more information about the device orientation event, take a look at the W3C website.

Press the "G" key on my homepage to see what I've done with this new event with just a small script.

Back to overview

Comments