Can I receive tilt events in JavaScript on mobile Webkit for iOS or Android phones?

I did a few searches and did not find any good links to non-touch events provided by mobile browsers. Does anyone know of any good resources to support tilt events or experience with such things?

I am really looking forward to adding some yaw controls.

+4
source share
2 answers

You are looking for HTML5 DeviceOrientation and DeviceMotion. Currently, most modern smartphone browsers support these events.

Here is a useful lesson: http://www.html5rocks.com/en/tutorials/device/orientation/

+8
source

[edit]

Unfortunately, at this time, without starting as a native application, events from the accelerometer are not available.

Documentation for: Supported Events for Safari on iOS

If you need these events, consider moving to your native application and checking out Phonegap - it has what you are looking for, supports both iOS and Adroid, and much more.

Here is a quick link: to access API documents

+3
source

All Articles