Tilt: The “joys” of mobile web
December 15th, 2011We are fast reaching the end of the 25KB era. 3G network speeds mean we no longer need to keep our pages (and all of their assets, cached or otherwise) under 25KB for reasonable performance.
That said, iPhone and Android users expect a rich web experience, 3G isn’t all that fast and like Firefox and IE of old, Mobile Safari and Mobile Chrome come with bizarre incompatibilities.
Take rotation for example.
Resize events happened on the desktop, but they happened in relatively controlled, incremental steps and you always knew what was happening. Resize events would fire on the window object and you could relatively easily determine the height and width, especially with libraries.
Not so in mobile. Mobile Safari fires a resize event, but may not present the new height and width to you. It all depends on which version of iOS you’re running. Android, however, does. Frankly, I’m not sure how Mobile Firefox and Opera 5 behave on those devices, not having one to test on.
Both browsers do update the window.orientation property, but for some reason, Mobile Safari doesn’t present 270 degrees (portrait, but with the button at the top), overloading 0 for that purpose.
Confusingly, the same version of Mobile Safari doesn’t behave the same across dissimilar devices. You can have a slightly different experience between an iPod Touch, an iPhone 3GS, an iPhone 4, an iPhone 4S, the iPad 1 and the iPad 2. (These being the Apple devices that commonly require support).
For example, on certain versions of iOS, media selectors can be applied differently.
Both platforms fire both onresize and onorientationchange events, but not always in the same order.
Worse still, the versions of Android can behave differently as well. Today, there is still a significant user base on 1.5, 1.6, 2.0, 2.2, 2.3, 3.0 and 4.0 is now entering the market.
In short, assume very little when working in the mobile space and try to test in a wide array of devices, because each browser can be very subtly different.


