Welcome!

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

Reply
Developer
Posts: 1,230
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone
Accepted Solution

Screen size wrong (Dev Alpha)

OK - I have this

 

<meta name="viewport" content="initial-scale=1.0; target-densitydpi=device-dpi; width=device-width; height=device-height; user-scalable=no;" />

A Dev Alpha is 1280 x 768 - I trust the source of this info (BB guy)

 

Try something dumb like this...

 

alert(window.innerWidth + ' x  ' window.innerHeight);

 

I'm getting the numbers - gimme a sec...

 

Stupid password thing

 

570 x 342

 

Huh?




Click the like button if you find my posts useful!
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Screen size wrong (Dev Alpha)

I don't have a dev alpha. But I can tell you on a BB10 phone it returns:

 

alert(window.innerWidth + ' x ' +  window.innerHeight);

 

768x1280

@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 1,230
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Screen size wrong (Dev Alpha)

Are you using the meta?

 

I'm using similar code and getting 1/2 the numbers back

 

I may as well just strip out the viewport tag and see where that takes me

 

This is very annoying

 

I had to check with my BB guy about the size which was very embarrasing as I know the numbers to expect

 

 




Click the like button if you find my posts useful!
Contributor
Posts: 22
Registered: ‎02-21-2012
My Device: Playbook torch 9800
My Carrier: Telus

Re: Screen size wrong (Dev Alpha)

Hi I had the same problem. you need to add the following:

 <script>
	var meta = document.createElement("meta");
	meta.setAttribute('name','viewport');
	meta.setAttribute('content','initial-scale='+ (1/window.devicePixelRatio) + ',user-scalable=no');
	document.getElementsByTagName('head')[0].appendChild(meta);
   </script>

source: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-set-up-the-viewport-for-a...

 

Have a great day!

Developer
Posts: 30
Registered: ‎12-15-2012
My Device: Z10 LE, Playbook and Dev Alpha C
My Carrier: BASE

Re: Screen size wrong (Dev Alpha)

I had a similar problem and completely removed the meta viewport. Which worked, my bbUI.js app is running fine without viewport.