Apple has added support for accelerometers and gyroscopes to the new version of Safari supplied with the recent iOS 4.2 release.
All iOS devices — iPhone, iPod touch and iPad — have an accelerometer to detect spatial movement, both for controlling apps, notably games, and for tasks such as shake-to-undo. iPhone 4 also has a three-axis gyroscope to enable even greater motion control.
Previously these could only be accessed using the APIs available to registered app developers. But with Safari’s support for the open DeviceOrientation standard, any web app can employ motion controls. The Mobile Web Programming blog has built an example app to demonstrate how it works.
Apple has also integrated several new HTML5 technologies, notably WebSockets, which as Mobile Web Programming notes “is great news for chat and real-time applications” because it will reduce the frequency with with such apps will have to call the server.
Safari also gets update support for HTML5 forms, SVG and the Canvas element, including support for ImageData data-type, a Javascript method for manipulating images pixel-by-pixel.
And with iOS 4.2 introducing wireless printing, Apple has added a method for invoking the print dialog from within a web page.













