Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

forcing web-site to show in landscape mode only

I want to show my web-site in landscape mode only, is it possibile? It does not matter what the orientation is of device in user's hand but the web site will always be in landscape mode. I have seen iPhone application working like that but can this be done for a web-site?

like image 293
coure2011 Avatar asked Jan 05 '12 05:01

coure2011


People also ask

How do I change my default orientation to landscape?

In the Ribbon menu bar, click the Layout or Page Layout tab. In the Page Setup section, click the Orientation option and select Landscape.


1 Answers

@Golmaal really answered this, I'm just being a bit more verbose.

<style type="text/css">     #warning-message { display: none; }     @media only screen and (orientation:portrait){         #wrapper { display:none; }         #warning-message { display:block; }     }     @media only screen and (orientation:landscape){         #warning-message { display:none; }     } </style>  ....  <div id="wrapper">     <!-- your html for your website --> </div> <div id="warning-message">     this website is only viewable in landscape mode </div> 

You have no control over the user moving the orientation however you can at least message them. This example will hide the wrapper if in portrait mode and show the warning message and then hide the warning message in landscape mode and show the portrait.

I don't think this answer is any better than @Golmaal , only a compliment to it. If you like this answer, make sure to give @Golmaal the credit.

Update

I've been working with Cordova a lot recently and it turns out you CAN control it when you have access to the native features.

Another Update

So after releasing Cordova it is really terrible in the end. It is better to use something like React Native if you want JavaScript. It is really amazing and I know it isn't pure web but the pure web experience on mobile kind of failed.

like image 150
King Friday Avatar answered Sep 28 '22 05:09

King Friday