Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 173
Registered: ‎12-10-2012
My Device: Dev Alpha C
My Carrier: -
Accepted Solution

How to lock orientation in javascript?

I seemed to have gotten myself in a bit of a pickle and don't know the solution.


I have a small collection of apps that I want to condense into a single app.


I will set them up with two menus, one works  properly in portait, the other in landscape. I know I can set orientation in the config file, which is what I have done to this point. But what I need to do is:


User presses one option on main menu, goes to menu locked into portrait. All apps that get clicked from that menu also need to be locked in portrait.


If user presses other option from main menu, they go to a menu set in landcape. All apps that get clicked on from that menu need to be in landscape.


So basically I need to meld two groups of apps together, half work in portrait only, the other in landcape only. Can orientation be locked programmatically from javascript? I expect it can be... just not sure how.

Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to lock orientation in javascript?

Hi there, check out orientation.js in this sample for WebWorks APIs that are aimed at locking rotation:

The full documentation can be found here:

Unfortunately HTML5 doesn't have lockOrientation APIs as a part of the standard yet, so you'll have to rely on the WebWorks implementation for now.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Posts: 173
Registered: ‎12-10-2012
My Device: Dev Alpha C
My Carrier: -

Re: How to lock orientation in javascript?

Thanks, I'll give that a try later. I figured something like that had to exist (or hoped it existed).