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
New Developer
navan1983
Posts: 60
Registered: ‎01-16-2009
My Device: Not Specified

Blackberry Bold : Get Browser Height and Width

How to get the Browser Height and Width in Blackberry Bold through java script?

 

Thanks,

Navaneeth

Please use plain text.
Developer
abarber
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: Blackberry Bold : Get Browser Height and Width

Hello

 

Have you tried 

screen.availWidth

screen.availHeight

 

 These are the properties of the screen object.

 

availHeight int Returns the height of the BlackBerry device screen that is available to the BlackBerry®
Browser, in pixels. This may be equal to or less than the value of Screen.height.
read only


availLeft int Returns the screen space available to the left of the browser window. In the case of the
BlackBerry Browser, this property always returns a value of “0”.
read only


availTop int Returns the screen space available above the browser window. In the case of the
BlackBerry Browser, this property always returns a value of “0”.
read only


availWidth int Returns the width of the BlackBerry device screen that is available to the BlackBerry
Browser, in pixels. This may be equal to or less than the value of Screen.width.
read only


colorDepth int Returns the bit depth of the color palette. This property behaves identically to the
pixelDepth property.
read only


height int Returns the height of the BlackBerry device screen, in pixels. read only


pixelDepth int Returns the color resolution, in bits per pixel, of the display. read only


width int Returns the width of the BlackBerry device screen, in pixels. read only

 

Cheers

 

Andrew

Please use plain text.
New Developer
sollex
Posts: 4
Registered: ‎07-08-2009
My Device: Not Specified

Re: Blackberry Bold : Get Browser Height and Width

Hi I am trying to get this working exactly how you have recomended but the script is crashing.

have you tryed to use it?

document.write("resWidth: " + screen.availWidth + " resHeight:" + screen.availHeight);

 

thanks.

Please use plain text.
New Developer
sollex
Posts: 4
Registered: ‎07-08-2009
My Device: Not Specified

Re: Blackberry Bold : Get Browser Height and Width

Actually never mind I just got it . It works
Please use plain text.
New Developer
toddm
Posts: 13
Registered: ‎01-03-2009
My Device: Not Specified

Re: Blackberry Bold : Get Browser Height and Width

Another way is window.innerWidth.  You can put alert(window.innerWidth) in a javascript function and it will display the width in a pop up so you can verify it's working as you expect.
Please use plain text.