Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to receive tilt events in JavaScript on mobile Webkit for iOS or Android phones? [closed]

I've done some searching around and haven't found any good references for non-touch events provided to mobile browsers. Does anyone know of any good resources for what tilt events are supported or have experience with such things?

I'm really looking forward to adding some yaw controls.

like image 824
Daniel X Moore Avatar asked Oct 22 '10 05:10

Daniel X Moore


2 Answers

You are looking for HTML5 DeviceOrientation and DeviceMotion events. Most modern smartphone browsers support these events now.

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

like image 103
Ariful Islam Avatar answered Oct 04 '22 13:10

Ariful Islam


[edited]

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

Documentation for: Supported Events for Safari on iOS

If you want these events, consider going for a native app, and checkout Phonegap - it has what you are looking for, supported by both iOS and Adroid, plus considerably more.

Here's a quick link: to get up'n the API docs

like image 28
defbyte Avatar answered Oct 04 '22 14:10

defbyte