View Full Version : New windows and dual monitors

01-10-2012, 07:15 PM
Ok I need to open a popup in a second monitor. The browser will be open in the first monitor and the popup needs to open in the second monitor (we'll say it's to the left for now). I have tried a few Javascript methods. I don't have PHP avaliable to me in this case but I do have the ability to use JSP and will shortly have JQuery.
Here is what I have tried so far:

<script type="text/javascript">
function popup(url, winName, xOffset, yOffset) {
var x = (window.screenX || window.screenLeft || 0) + (xOffset || 0);
var y = (window.screenY || window.screenTop || 0) + (yOffset || 0);
return window.open(url, winName, 'top=' +y+ ',left=' +x);
<input type="button" onClick="popup('http://www.google.com', 'myWin', -600, 100)" value="Show Customer"/>

<script type="text/javascript">
function popup() {
window.open( "http://igatedev.kirbyrisk.com/DualMonitorTest/product.jsp?part=545347", "myWindow",
"status=0, fullscreen=0, resizable=1" )


Any help is much appreciated. Also I was wondering if there was a way to have the popup close with the original window, or with a button click from the first.

01-10-2012, 08:43 PM
being perfectly honest I dont think you can specify which monitor with javascript. You can make it open in a new tab, cant even specify whether its a new tab in the browser, it just does that sometimes. In my opinion, you're wasting your time trying to work out how to do this (I don't think its possible).

I might be wrong, but pretty sure I'm not.

Philip M
01-10-2012, 08:45 PM
In my opinion, you're wasting your time trying to work out how to do this (I don't think its possible).


01-10-2012, 09:09 PM
So I couldn't specify a positioning for the window to open that could cause it to open in the second monitor?

01-10-2012, 10:26 PM
I think the problem lies here -

javascript works WITHIN the browser, not the operating system.
What you are trying to do is act OUTSIDE IT'S SCOPE OF INFLUENCE

if such things were possible they would make javascript machine specific, specific to your operating system and its bounds, the whole point of javascript is that it works in any browser in any device, its non-specific

Hope that answers your question

Old Pedant
01-10-2012, 10:41 PM
I dunno if I can 100% agree on this.

After all, when you pop up a new window via JS, you *can* specify the x/y position of the new window *ON THE SCREEN*. That is, you are *not* confined to the current browser window dimensions.

*IF* the operating system treats a dual monitor system as if it is a single big wide screen, then you'd expect that you could position the new window any place in that big wide screen.

I know that when I used Linux on a dual monitor system, I could actually drag a window so that it sat half on one monitor and half on the other. That is, the two monitors were treated as just a super wide screen.

So *IF* you can position a window--just using the window drag controls--so that it sits anywhere on the dual monitors, including straddling them, then I *would* expect that you could absolutely position a popup where you wanted. Now, that's a really big "IF*. But still...

(And I hope to find the answer to this myself soon...will be upgrading to a 2 or maybe 3 monitor system using Windows 7. We'll see if it's capable of this.)