Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2011
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts

    New windows and dual monitors

    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:
    Code:
    <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); 
    } 
    </script>
    <form>
    <input type="button" onClick="popup('http://www.google.com', 'myWin', -600, 100)" value="Show Customer"/>
    </form>
    and
    Code:
    <script type="text/javascript">
    function popup() {
    window.open( "http://igatedev.kirbyrisk.com/DualMonitorTest/product.jsp?part=545347", "myWindow", 
    "status=0, fullscreen=0, resizable=1" )
    }
    
    </script>
    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.

  • #2
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts
    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.
    <DmncAtrny> I will write on a huge cement block "BY ACCEPTING THIS BRICK THROUGH YOUR WINDOW, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE INSTALLATION OF THIS BRICK INTO YOUR BUILDING."
    <DmncAtrny> And then hurl it through the window of a Sony officer
    <DmncAtrny> and run like hell

    Portfolio, Tutorials - http://www.nomanic.biz/

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by nomanic View Post
    In my opinion, you're wasting your time trying to work out how to do this (I don't think its possible).
    Agreed!

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    New Coder
    Join Date
    Mar 2011
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts
    So I couldn't specify a positioning for the window to open that could cause it to open in the second monitor?

  • #5
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts
    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
    <DmncAtrny> I will write on a huge cement block "BY ACCEPTING THIS BRICK THROUGH YOUR WINDOW, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE INSTALLATION OF THIS BRICK INTO YOUR BUILDING."
    <DmncAtrny> And then hurl it through the window of a Sony officer
    <DmncAtrny> and run like hell

    Portfolio, Tutorials - http://www.nomanic.biz/

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    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.)
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •