Dear Apple Claus,
I’ve been a very good boy this year so I hope you don’t me asking for a little present. What I’d really like for Christmas is for you to fix that strange orientation scaling bug in Mobile Safari.
Just in case you’ve forgotten about it, my friend Scott—who has been a very, very good boy this year (what with that whole Boston Globe thing)—put together a test page quite a while back to demonstrate the problem.
Basically, if I set meta name="viewport" content="width=device-width, initial-scale=1.0"
then it means a pixel should be equal to a pixel: in portrait view, the width should be 320 pixels; in landscape view the width should be 480 pixels. But in Mobile Safari, if I move from portrait to landscape, the width jumps to a value larger than 480 pixels, which means the hapless user must double tap to bring the scale down to 1:1.
Now, admittedly, I could just set meta name="viewport" content="width=device-width"
and leave it at that (or I could additionally declare minimum-scale=1.0
). But then when the user changes from portrait to landscape, although it doesn’t have the same over-zooming behaviour, it does scale up. That means I’m not getting the full 480 pixels (it’s effectively still a 320 pixel wide display, even in landscape).
I could make the bug disappear by adding maximum-scale=1.0
or user-scaleable=no
but that’s the cure that kills the patient. I also did some hacking with Shi Chuan but what we come up with still feels fairly clunky.
So that’s why I’m writing to you, Father Applemas. Won’t you fix this bug for me?
My friend PPK thinks you won’t fix this bug because it would trigger a reflow (and repaint) of the page …but I know that can’t be the reason because the bug doesn’t occur when going from landscape to portrait!
Also—and this is the really strange part—If I’m looking at a web page on my iPhone/Pod in a custom browser (like the Twitter app), rather than using Mobile Safari, then the bug doesn’t occur.
I don’t get, Apple Claus. Why have one behaviour for webviews in other people’s apps and a different behaviour for your own app?
Anyway, if you could see your way to granting this boy’s wish, it would make for a webby Christmas.
Hugs and kisses,
Jeremy
P.S. By this time next year, it would be lovely to have access to the camera (and other device APIs) from the browser …but I’m getting ahead of myself.
Update: the bug has been fixed in iOS 6.