views:

748

answers:

5

Is it possible to tell if the user of a website is using multiple monitors? I need to find the position of a popup but it's quite likely the user will have a multiple monitor setup. Whilst window.screenX etc. will give the position of the browser window it's useless for multiple monitors.

A: 

I do not believe that it is possible right now; however js is becoming more popular for desktop use in widgets in addition to web development and that would be an excellent feature to request for a future version

Causas
I wonder if it's something a project like Gears might implement?
slashnick
Gears is about storing data.
Till
+2  A: 

I found this as a solution that someone has used... I do not see why you couldn't trust it.

[if the width is greater then (Height/3) * 4 > (Screen.Width) THEN]

[User has dual monitor]

[End If]

Patcouch22
Uh... I stack my screens. Height > Width. Neither screen has the same width, so if you were hugging the max-width you would end up off-screen beyond a certain height. Not to mention two-above, one below configurations.
Shog9
Also, lots of monitors have wider aspect-ratios than 4:3
Neall
Some machines (my own) are set up as two seperate desktops so the height and width are only returned for the screen the browser is on.
slashnick
A: 

You can't do that. You could position the popup centered on the parent window however. I think it's a better idea to show a "div" as dialog in the middle of your website, because the chance that this is popup blocked is smaller and it's IMO less annoying.

Armin Ronacher
A: 

What about the size of the screen? Multiple screens have usually a great size. Just check the sizes and decide if it's reasonable to be on just one or more screens.

unexist
+1  A: 

You could make a well-educated guess with JavaScript's screen.width (.availWidth) and screen.height (.availHeight).

My idea was to assume (!) that monitors in general follow a certain ratio, whereas the .[avail]width should be outside of it because the screen is duplicated only in terms of width, but not height.

Writing this answer, it sounds like a severe hack though. Nothing I would really rely on.

Till