Shake It Up: Safari in iOS 4.2.1 Adds Accelerometer, Gyroscope Support

This image described by iOS Safari, Apple-safari

Along with the new iOS release, Apple has update the Safari browser — but didn’t update the documentation at first, forcing clever hackers to grovel through the code to find new and interesting things to do with it.

Like, f’rinstance, Maximiliano Firtman, whose Mobile Web Programming blog — never mind his O’Reilly book Programming the Mobile Web — might suggest that yeah, the guy’s into coding for handheld web browsers.  A lot of Firtman’s discoveries border on the techno-arcane (“Partial XHR-2 support?”  “New DOM events?”), some we already know about (AirPrint support), but one code reveal can be understood even by laymen:

Safari now supports the iDevice’s Accelerometer and (if its a newer iPhone/iPad or an iPod Touch 4G) Gyroscope, via the “DeviceOrientation API.”  That means that, in theory, web apps can be built that are controlled by how (and how fast) you turn, tilt, and shake your handheld device.  Firtman even managed to cruft together a quickie demonstration of the new API calls, and put the video evidence on YouTube for all to see:

Oh, and if you find out any more low-level code goodness, Firtman encourages you to let him know in the comments section of the blog post, or shoot him a tweet (@firt).


About Dactyl Anapest

Google + Profile