Lock portrait mode for mobile

Is is possible to lock a Web App to portrait mode so the browser does not repaint when a mobile device is rotated?

Thanks.

http://documentation.xojo.com/index.php/WebSession.OrientationChanged can be used to detect the rotation but there may not be a way to prevent the mobile browser from rotating the WebPage content since that’s what mobile browsers are expected to do. If I’m wrong, hopefully someone else will chime in with just how to keep the WebPage content in portrait mode regardless of the orientation of the device.

If you describe why you want to keep your content in portrait mode then some suggestions might be provided to help you attain that goal in some other way.

You can’t lock a browser to a particular orientation. What you can do is load another page. In the OrientationChanged event, if the angle is 90 or 270, you could show a page that simply says “Not Supported” or tells the user to please rotate their device again. Once it’s back at 0, just hide the page.

Greg,

Thanks. I guess that is an OK work around for now. Later I can put in the effort to detect the rotation and create a new functional page with a different layout. My app is in a bit of a “transition” by the customer so if I made pages for each orientation I would end up doing twice the work to modify each separately. Once the functionality of the portrait version is settled then I an make specific landscape pages.

Thanks,

Mark