cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 3.0 - Can't detect screen resolution

former_member238607
Participant
0 Kudos

Hi,

I'm using Personas 3.0 SP3, and I'm trying to add code to detect the user's screen resolution. Actually, I'm hoping to detect the available screen area, depending on if the user's screen resolution and window size. My goal is to center objects on the screen, based on the available area.

In researching this, I keep finding references to the following code. However, when I try to use it, the value comes back as "undefined".

// 1. Check your screen size 

var screenSize, flavor; 

screenSize = session.findById("wnd[0]").width;

I've played around with the supplied options for this statement, and found the following returns a value, which seems to change depending on the size of the window I run it in. However, the returned value is pretty small, so I know it's not pixels. I'm not sure if there is a way to use this code or not.

screenSize = session.findById("wnd[0]").getProperty("width");

Any thoughts on how I can determine the usable screen area? Thanks for your help!

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

hi jeff,

in your screen event, just use

var screen_size = width;

Using "width" which is a reserved keyword will give you the updated dimensions, rather than using user area width. And then may be you can save it in a session variable and use it.

Regards,

Sushant

0 Kudos

hi jeff,

sorry correction here.

If you are already on Sp03 with latest client note, use the following:

session.info.clientHeight

session.info.clientWidth

You can check the API documentation too.

Regards,

Sushant

former_member238607
Participant
0 Kudos

Hi Sushant,

Sorry for the delay, we were not on the most current client note, so I waited for Basis to apply the note. We are now current, and session.info.clientHeight and clientWidth is working. It's just what I was looking for.

Thank you very much for your help!

Jeff

Answers (0)