Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The iPhone supports two different types of gestures. Touching the screen is what more immediately comes to mind when you think about user input, but moving the iPhone around—as measured by the accelerometers—is another way in which users can manipulate their iPhone. If you need precise accelerometer data, you’ll have to design using the SDK (as discussed in chapter 17), but with the WebKit you can at least recognize orientation changes.
The orientationchange event notifies you when a user has rotated the iPhone after your web page has loaded. Besides just notifying you that an orientation change has occurred, the iPhone maintains a special orientation property in the window object that advises you of the iPhone’s current orientation, as described in table 4.11.