SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parent page refresh on window close

    Hi all,

    I have this same javascript on a different site and it works. I just replaced the address in the script so that it obviously refreshes the correct page, but it's not doing it.

    Code:
    <html>
    <head>
    <title>Edit Hotel Notes</title>
    
    <SCRIPT language=JavaScript>
    <!--
    function win(){
    window.opener.location.href="reservations-edit.php?p=5685#bottom";
    self.close();
    //-->
    }
    </SCRIPT>
    </head>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    <center>
    <p>Note has been edited. Please click the buton below to close this window.</p></center>
    <center>
    <input type=button onClick="win();" value="Close this window" />
    </center>
    </body>
    </html>
    I'm confused as to why it works in one situation, but not in another.

    Thanks for any help.
    No, I REALLY dislike having to use Joomla.

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code works for me:

    opener.location.reload();

    never had a problem

  3. #3
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!
    No, I REALLY dislike having to use Joomla.

  4. #4
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dc -

    I've ran into a problem with that code in IE 7.

    Page A has a form that you can submit notes as well as lists the notes that have been added. The edit link for each list item opens a small popup window that the notes are edited in (Page B). When Page B is closed, Page A needs to refresh to show the updated note in the list.

    If, in IE 7, you submit a new note and then try to immediately edit it it messes up. After you save the update and close Page B, Page A throws a warning saying:

    To display the webpage again, IE needs to resend the information you've previously submitted.

    If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again.
    So, if I hit Retry, it resubmits the new note that was just added and I end up with duplicate entries. If I hit cancel, the note doesn't update cause Page A isn't refreshed.

    Suggestions please?
    No, I REALLY dislike having to use Joomla.

  5. #5
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I need it to refresh and go to the bottom of the page, but javascript seems to not like anchor tags in the referrer url since if I tack on #bottom to the referral url it just doesn't refresh the page at all.
    No, I REALLY dislike having to use Joomla.

  6. #6
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've also tried this with no success.

    jscript:
    Code:
    function redirect(linkid){
    opener.location.href(linkid);
    window.close();
    link:
    HTML Code:
    <a href="javascript:redirect('http://www.site.com/path/to/page.php?p=<?php echo $p; ?>#bottom')">Click here to close this window and refresh the note list</a>
    No, I REALLY dislike having to use Joomla.

  7. #7
    SitePoint Addict
    Join Date
    Apr 2003
    Posts
    332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by crowden View Post
    javascript seems to not like anchor tags , it just doesn't refresh the page at all.
    This is an issue brought up in several threads. If we could get an insight into this phenomenon, addressing this thread would be easier.

    Andy


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
  •