One new feature that we’re including as part of Firefox 3.6 is support for web pages to access machine orientation information if it’s available. As you can see from the demo above you can use it to figure out if the machine is moving and what direction it’s facing.
Using the API is very simple. All you have to do is add a simple event listener:
window.addEventListener("MozOrientation", function(e) {
/* 3 values: e.x, e.y, e.z */
}, true);
Originally built as something that we would include for our upcoming mobile browser release, we’ve made it available on desktop systems as well. Many modern Macbooks and Thinkpads contain devices and drivers that expose this information. We’ve added support for Linux, Macs and some Thinkpads where drivers and devices are available. (Note, on some Macbooks detect the orientation information backwards – we’re working on that.)
You can find more information on two posts by Doug Turner and an update on documentation for orientation from Eric Shepherd.
Paul Rouget has this and some other demos up in one of his posts.
61 comments