App doesn't work in Portrait mode, can I stop it from rotating? iPad

73 views Asked by At

I'm developing a temporary web app for the iPad. It's really just a stop-gap until a proper mobile solution can be devised for this particular product.

One issue is this app works and looks perfect in Landscape, but in Portrait mode, the dimensions just don't fit.

I'm sure this is a horrible usability crime to even ask such a question, but is there any sort of convention for prohibiting a web app from rotating to Portrait mode?

I'm not looking for an examples of code, I'm just wondering if anything like this exists.

2

There are 2 answers

0
Helge Becker On

No, there isn't an option. After all html is all about dynamic display of information. Just define the elements of your webapp proper and it will look fine.

0
SSS On

You can use the orientation change function to check for the orientation and then show a image or div stating the user that webapp can be opened only in Landscape mode.

window.addEventListener('orientationchange', function(event) {
   if (window.orientation == 90 || window.orientation == -90)
   {
       /* Hiding the Message div */           
   }
   else
   {
       /* Show a div in Portrait Asking users to switch orientation to Landscape */
   }
  });