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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified
Accepted Solution

Adapting to screen orientation using javascript (for playbook)

Hi All,


I know the screen orientation topic has been gone through many times already, but i've searched and searched in the webworks thread for an answer and can't find it.


My app is made for landscape. I have 2 options. 1) Lock the app into landscape which I beleive still can't be done using webworks (but please correct me if i am worng) or 2) scale the app for portrait.


Since to my knowledge 1) cannot be done, i'll focus on 2). Has anyone seen or written a javascript/css script which will check if the user is holding the tablet in landscape or portrait and adapt to switching b/w the 2 on the fly? My app is made for 1024x600. I know it can be scaled using the CSS on startup to 0.6 to fit the screen, but i am not sure how to check and then re-scale afterward with javascript.


Any help, please and thanks.



Posts: 29
Registered: ‎02-25-2011
My Device: PlayBook
My Carrier: Rogers

Re: Adapting to screen orientation using javascript (for playbook)

[ Edited ]

Actually, you can lock it in landscape orientation by putting


<rim: orientation mode="landscape" />


in your config.xml. Just remove the space after "rim:" because I added it to prevent the message board from rendering it as Smiley Surprised, haha.

PlayBook Apps: EveryDay Converter
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: Adapting to screen orientation using javascript (for playbook)

This worked great!!! Thanks so much for this. I spent so much time looking into resizing for flipping, this is so much easier and the game is in its proper format now.

New Developer
Posts: 7
Registered: ‎06-08-2012
My Device: developer
My Carrier: NOKIA

Re: Adapting to screen orientation using javascript (for playbook)

Your method is available, and  solves my problem which puzzled me for many days.

Thank you!