views:

22

answers:

2

I'm wondering if it's possible to lock the aspect ratio using a meta tag, or by any means at all?

I'm making a web app where the target platform is the iPad, but it only really makes sense if it is always in landscape orientation, and i was hoping to ensure it was always presented that way regardless of the device orientation.

A: 

It is not possible to force Mobile Safari to use a certain orientation when loading your web app.

The only viable alternative I can think of considering your situation, is detecting the orientation using JavaScript or CSS, and if it's in portrait (or upside-down portrait), you present a message telling the user to rotate their iPad instead of displaying the web interface right away. Once the orientation changes to landscape (or the web app was loaded in that orientation), present your web interface.

BoltClock
A: 

Add an event listener for window.onorientationchange, after you catch the event, you can use window.orientation to detect the current orientation and advise the user to rotate the device.

Farid