-1

Possible Duplicate:
Prevent orientation change in iOS Safari

I have one HTML 5 web site with C# Code for iPhone,iPad and Android tablets which should be viewed only in landscape mode but not in portrait mode.
If user changes the orientation of any device to portrait mode, even then the website should be in landscape mode only.

Community
  • 1
  • 1
Jagadeesh
  • 1,630
  • 8
  • 24
  • 35

2 Answers2

0

You can't rotate your website inside of a WebView, so you need to lock the current view rotation in landscape mode. That way all of the content on this page will be in landscape, including your website. I see this like an only solution.

lonlywolf
  • 505
  • 5
  • 16
0

It's not possible to change or freeze a device orientation from web-browser, without an external helper application. The whole idea of locking device seems having a need to be reconsidered and redisigned. Here is one of the menthods you can use.

I think this is not a device orientation what is important to your site, but a landscape design in its content. For this requirements you should place your entire site content into a container, which must be always scaled to fill browser window (width:100%) and maintain its height in required aspect ratio to the width.

In landscape's device orientation your site will operate as usual. In the portrait mode, the content will be displayed scaled down to current width, with black regions in top and bottom of browser's window (much like when you view 16:9 movie on 4:3 screen), if you align the container vertically.

If you can afford your content to be aligned at a top of window (with larger black region beneath), you can delegate entire process of the scaling to the browser itself by specifing meta viewport:

<meta name="viewport" content="width=device-width">

If it doesn't suit your needs, it would be helpful if you provide more info about the site specifics.

Stan
  • 8,683
  • 9
  • 58
  • 102