This section covers the HTML5 orientation API: a way to use angle measures provided by accelerometers from mobile devices or laptops such as MacBooks.
Beware: all examples must be run on a device with an orientation sensor and/or with an accelerometer. Furthermore, Chrome/Safari and Mozilla support this API, but Opera mobile doesn't (yet) at the time of writing.
If it provides a "mobile device emulation mode", you can use the devtools of a desktop browser to fake the orientation values (see the support table below, the columns for desktop versions of browsers are about the support for this emulation mode).
The W3C specification: The Screen Orientation API
Article on HTML5Rocks.com about device orientation: Device Orientation and Motion
Browser compatibility:
DeviceOrientation & DeviceMotion events on CanIUse
DeviceOrientationEvent and DeviceMotionEvent on MDN