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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Posts
    433
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy window.opener.closed

    Why this does not work?
    Hi I want to check if the window that had opened the small window is still opened.
    So I write this code in the small window


    <script language="JavaScript">
    <!---
    function check() {
    if (window.opener.close) {
    window.open("openercheck.htm","hi");
    }
    }
    //-->
    </script>
    </head>

    <body bgcolor="#FFFFFF" text="#000000" >
    <script language="JavaScript">
    window.setInterval("check()",1000);
    </script>


    it works only in netscape 4.75 but is does not in ie 5!!
    I am calling every second the check function . The check function checks if the main window is still opened . If it is not open is again .

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    I believe IE has a known bug where window.closed returns the opposite it is supposed too... MSDN should have an article on it somewhere.

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Can you try:

    if (!window.opener) {
    window.open("openercheck.htm","hi");
    }
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Could be that bug; but your original code is incorrect....

    <script type="text/javascript" language="javascript">

    setInterval('if (opener.closed) open("openercheck.htm","hi")',1000);

    </script>


  •  

    Posting Permissions

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