After Apple released iOS 4.2, Apple also updated mobile Safari to support various new HTML5 and W3C standards. Of these updates, Apple enabled the use of an iDevices’ accelerometer and gyroscope within mobile Safari.
Before this find, many users assumed that the gyroscope was an app-only function and did not have support for stock iOS apps. This discovery came from mobile programmer Maximiliano Firtman:
As you may know, all iOS devices have accelerometer sensors (plus magnetometer and gyroscope on some devices). However, as web developers, we didn’t have access to such sensors until now. Safari now supports the DeviceOrientation API (W3C draft). Looking at the available objects, it seems that all the API is fully supported (including ondeviceorientation and ondevicemotion events).
Proving his new found feature, Firtman created a brief demo on iOS 4.2 of the new browser capability:
As this discovery continues to filter through the developing community, more functions will be created that take advantage of the new mobile Safari capabilities.
More recently, Occipital, makers of the “360 Panorama” photo app, has taken advantage of the new mobile Safari functions to provide in-depth views of panoramic photographs. As an example, the following link viewed on iOS 4.2 devices showcases the gyroscope function in mobile Safari by simply rotating the device to view the photo.
If viewed on any other device however, users will only be able to use their finger to navigate the photo.
Using 360 Panorama, users can capture a photo, upload the photo, and receive a URL to view the panorama in Safari. When viewing the photo on iOS 4.2, users will see “Gyro ON”, at which point users can rotate their device to view the photo.
Check it out!