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
    Regular Coder
    Join Date
    Jul 2002
    Location
    New Zealand
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Refresh Another Window

    I have a link on my site that opens a new window. When a use is finished with the new window, I would like it to close and refresh the page that opened it. I think that I could use something like:

    window.windowname.reload();
    window.close();

    but how would I set the 'windowname' the original page?

    Any other thoughts on how this could be better are also appreciated, I am not all that hot on javascript.

    Thanks.
    eTheory - the theory of revolution

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Is the close button in the parent or the new window?

  • #3
    New Coder
    Join Date
    Oct 2003
    Location
    Ukraine
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    in IE - window.opener.location.reload(true)
    or window.opener.open('your url',_self,'size and other options (optional)')

    Slava

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    New Zealand
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Close & Refresh Button

    Mr J, the close button is in the new window.
    eTheory - the theory of revolution

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    In the popup you could go

    <script>
    <!--
    function close_me(){
    opener.location="page.htm"
    self.close()
    }
    //->
    </script>

    where page.htm is the name of the opener page

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Should be:
    Code:
    function close_me(){
      if (opener && !opener.closed){ //make sure the opener window is still open
         opener.location.reload();
      }
      window.close(); //close popup
    }
    ...
    <input type="button" value="Close" onclick="close_me()" />


  •  

    Posting Permissions

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