Problem reloading parent window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Snolly

    #1

    Problem reloading parent window

    Hi all,

    Here is my issue. I have a web page (lets call it page1) with an
    iframe in it that then opens a pop-up window (page2). The pop-up
    window is used to edit some data that was loaded into page1 so I want
    to use onunload to reload page1 to keep the data synchronized.

    At first I was using just

    window.opener.p arent.location = window.opener.p arent.location;

    and this worked fine.

    Now I want to first set the text of page1, i.e.

    window.opener.p arent.document. write('Contents Updated...reloa ding
    page');

    and then reload it.

    So I now have the function:

    function reloadInfoPage( )
    {
    window.opener.p arent.document. write('Contents
    Updated...reloa ding page');
    window.opener.p arent.location =
    window.opener.p arent.location;
    }

    both lines of code work individually. The problem is that once I run
    the first line of code, the second line ceases to function. Any ideas?
    Thanks,

    Mark

  • Martin Honnen

    #2
    Re: Problem reloading parent window



    Snolly wrote:

    [color=blue]
    > function reloadInfoPage( )
    > {
    > window.opener.p arent.document. write('Contents
    > Updated...reloa ding page');
    > window.opener.p arent.location =
    > window.opener.p arent.location;
    > }[/color]

    Try
    var win = window.opener.p arent;
    var oldHref = win.location.hr ef;
    win.document.op en();
    win.document.wr ite('Contents ...');
    win.document.cl ose();
    win.location.hr ef = oldHref;


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Snolly

      #3
      Re: Problem reloading parent window

      Thanks Martin, your solution works perfectly.

      Comment

      Working...