📜 ⬆️ ⬇️

New hardware API for Firefox 3.6: orientation

One new feature that we make part of Firefox 3.6 is the ability for web pages to access information about the orientation of a computer in space when they are available. As you can see in the demonstration (only in the source, because Habrahabr does not allow using <video> in translations), you can use this information to find out if the computer is moving and in which direction it is turned.

Using the API is easy. Just add a simple event listener:
window.addEventListener ("MozOrientation", function (e) {
/ * 3 values: ex, ey, ez * /
}, true);
Initially putting the API as the desired part of our upcoming mobile browser release, we made the API available also to the desktop systems. Many modern Macbook and Thinkpad computers contain devices and drivers that make information about the position of the computer visible. We have added support for Linux, Macs, and some desktop pads that have drivers and devices. (Note that on some MacBooks, they determine the opposite orientation of the real one - we are still working on it.)

You can find more information in the two Doug Turner blogs and in the updated orientation documentation from Eric Shepherd.
')
Paul Rouget posted this and some other demonstrations in one of his blog posts.

Source: https://habr.com/ru/post/72249/


All Articles