views:

811

answers:

3

The new iPhone 3.0 OS is coming out soon. Does anyone know if it allows web apps to force landscape mode by a meta tag or javascript?

+4  A: 

Alas, if we knew, we couldn't tell you. It's all under a traditional Apple NDA.

Adam Wright
+1  A: 

The iPhone 3.0 SDK is a Beta and like all pre-release or otherwise unreleased information from Apple, it under non-disclosure.

You can download and look at it yourself by registering as a commercial iPhone Developer ($US99) but unpaid access and open discussion won't be permitted until the iPhone OS 3.0 is formally released.

Matt Gallagher
+1  A: 

I don't know about forcing the orientation, but you can certainly read it under at least 2.0 and above:

if( (window.orientation != 90) && (window.orientation != -90) )
   alert('Please rotate your iPhone into landscape mode.');

Or, to be more user-friendly, don't require them to click "OK."

Instead, listen for the event that occurs when the user rotates the screen, as described here:

http://www.sitepoint.com/article/iphone-development-12-tips/2/

Next, put all your content in one DIV and a friendly "please rotate" message in another.

<body class="portrait">
    <div id="content">My content goes here</div>
    <div id="rotateme">Please rotate your iPhone into landscape mode.</div>
</body>

Finally, style it so only one of the above shows up, depending on the orientiation:

body.portrait div#content { display: none; }
body.portrait div#rotateme { display: block; }
body.landscape div#content { display: block; }
body.landscape div#rotateme { display: none; }

This may not be the "iPhone 3.0 way" to do things (those who know aren't going to tell), but at least it will work regardless whether or not the user has upgraded. (Remember, iPod Touch users have to pay to upgrade and get few new features... they may not be as quick to jump on the 3.0 bandwagon.)

richardtallent