Mozilla

new device API for Firefox 3.6: orientation

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

Comments are now closed.

  1. Pingback from Firefox 3.6 çıktı / Fatih Hayrioğlu'nun not defteri on January 21st, 2010 at 15:11:

    [...] duruma göre vazife çıkaracak ve görünümünü ayarlayacak. Nasıl olduğunu görmek için videoyu izleyin. Çoğunlukla Mac kullanıcılarının kullanacağı bir özellik [...]

  2. Pingback from » Излезе Firefox 3.6 Мозила на македонски on January 21st, 2010 at 15:18:

    [...] на копмјутерот во 3Д светот благодарение на новото API. Исто така можете да ги користите drag&drop функциите [...]

  3. sakrist wrote on January 24th, 2010 at 08:18:

    Nice!

    look my version http://www.developers-life.com/use-matrix-of-rotate.html

  4. Melroy van den Berg wrote on January 27th, 2010 at 13:43:

    Very nice :|

  5. Pingback from Pune and Mumbai » arunerblog on March 11th, 2010 at 03:59:

    [...] stimulate discussion. I talked about HTML5 (inclusive of the WebApps APIs, such as the File API and Orientation Events), CSS3’s @font-face property, and discussed the potential this had for Indic fonts. We closed [...]

  6. Pingback from Mozilla Standards Blog » Blog Archive » Web Standards In the Device Era on March 12th, 2010 at 11:50:

    [...] ever since the introduction of onclick back in JavaScript’s infancy. And then, there’s Orientation Events, supported in Firefox 3.6 (with a really compelling demo — try it on the MacBook Pro and Fx [...]

  7. Clement Deschesnes wrote on March 13th, 2010 at 16:08:

    comment configurer facebook affin de pouvoir gérer le java-script et le flash qui
    m’empêche de jouer a toutes les applications

  8. James Duncombe wrote on November 24th, 2010 at 07:56:

    Love it guys, nice one! :)

  9. adipex wrote on December 28th, 2010 at 02:51:

    it sounds like a really great feature , anyone knows how can one without a location device can manually input his coordinates? maybe there’s a plugin for that ?

  10. Martin Kliehm wrote on February 11th, 2011 at 11:18:

    I got a new laptop (Dell Latitude E6510) that has a ST Micro Accelerometer built in. Alas the demo pages stay static. Does anybody know if it’s possible to access that accelerometer’s data using the orientation API?

  11. Pingback from Firefox 3.6 new device API: Orientation on May 28th, 2011 at 13:45:

    [...] some very interesting activity at hacks.mozilla.org lately. As Christopher Blizzard said in the according blog post “One new feature that we’re including as part of Firefox 3.6 is support for web [...]

1 2

Comments are closed for this article.