0

Is there any way to prevent the change of a websites orientation regardless of how a mobile device is rotated without having to write platform specific code? Under the circumstances the goal is to keep a site in "Portrait" mode.

VikingGoat
  • 387
  • 3
  • 8
  • 30
  • 1
    Nope. Best you an do is plan your site for a "responsive layout" without something like [Foundation](http://foundation.zurb.com/). A native client would give you more control, but in the JS world you can only detect when the size changes. – SciSpear Aug 08 '12 at 04:29
  • @SciSpear 'nuf said. You should post that as an answer. Preventing a handheld device from rotating the website simply goes beyond the limits of JavaScript. – Kiruse Aug 08 '12 at 04:33
  • @Derija93β€”it is possible with script (it's actually quite easy), but disabling orientation changes should only be done if there's an extremely good (usually very specific) reason. – RobG Aug 08 '12 at 04:43

1 Answers1

1

Nope. Best you an do is plan your site for a "responsive layout" without something like Foundation or Twitter Bootstrap. A native client would give you more control, but in the JS world you can only detect when the size changes.

Under the advice of @Derija93 I posted this as an answer so we can close this question.

EDIT: Now that being said. You might be able to fake it with some css translations (you will see it jump around).. but I really would not recommend going down this path.

Community
  • 1
  • 1
SciSpear
  • 2,008
  • 18
  • 18