Does anyone know how to either lock Mobile Safari's orientation to portrait, or to block landscape (via javascript or o开发者_C百科therwise)?
In other words, I want the web page to remain in portrait mode regardless of the orientation of the device.
You cannot lock orientation in iPhone's Safari browser. You can only detect it and make appropriate changes to your page.
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.
精彩评论