1

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.

Jeff Higgins
  • 11
  • 1
  • 2
  • This link will help to fix this issue [link for solution][1] [1]: http://stackoverflow.com/questions/1207008/how-do-i-lock-the-orientation-to-portrait-mode-in-a-iphone-web-application – peterkr Feb 24 '12 at 16:21

2 Answers2

2

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

Strelok
  • 50,229
  • 9
  • 102
  • 115
0

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.

Jakob Borg
  • 23,685
  • 6
  • 47
  • 47
  • 2
    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 Oct 15 '10 at 20:27
  • @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. – Jakob Borg Oct 15 '10 at 20:41
  • 1
    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 Oct 16 '10 at 18:22