views:

336

answers:

2

Does anyone know how to either lock Mobile Safari's orientation to portrait, or to block landscape (via javascript or otherwise)?

In other words, I want the web page to remain in portrait mode regardless of the orientation of the device.

A: 

I don't, but...

Consider very carefully whether this is a good idea or not. Personally I'm more often annoyed by the autorotation than not, especially when browsing in bed and the like. However, this should really be the user's own choice. It also looks like the next revision of iPhone OS will contain a software orientation lock, so that the user can disable autorotation at will.

calmh
There a stations where rotation is inappropriate for the app and make it less usable, such as using the phone as a tilt controller.. This should be a developer option
Anthony Johnston
@Anthony On a web page? I suppose it's possible, but then I think it falls under my "consider carefully", i.e. there are special cases where it might actually be appropriate, yes. I think for most of those cases we are probably talking about an actual native app and not a web app though.
calmh
@calmh I know this is what I want to do on one of my mobile safari apps, I have considered carefully, but it cannot be done, and my users will loose out because of it.
Anthony Johnston
+1  A: 

You cannot lock orientation in iPhone's Safari browser. You can only detect it and make appropriate changes to your page.

Strelok