SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to keep main window in background while popup window comes up

    I have a popup window that comes up when a user doesn't have access to a certain page within my site. The problem is when a user clicks on something the popup window comes up but the bigger sized window of that popup comes up in the background as well. I am trying to have my popup window come up while the original page I clicked from is still focused/seen in the background. This is the code I currently am using, can anyone help me with what I am missing. I have a back button but I won't need that if I want to maintain the original page in the background. Instead I will use a close button.

    Code:
    <html>
    <head>
     <title>JavaScript Popup Example 3</title>
    </head>
    <script type="text/javascript">
    function poponload()
    {
        testwindow = window.open("", "mywindow", "location=0,status=0,scrollbars=0,width=350,height=400");
         testwindow.document.write('<h1>Get outta here!</h1><a href="#" onclick="javascript: window.opener.history.go(-1)">Parent back button</a>');
    testwindow.focus();
    }
    </script>
    <body onload="javascript: poponload()">
    </body>
    </html>

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,595
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    You have no control over what window appears in front of which.

    The only way to get the control you want is to di it within the one page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

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