469,349 Members | 1,624 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,349 developers. It's quick & easy.

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.parent.location = window.opener.parent.location;

and this worked fine.

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

window.opener.parent.document.write('Contents Updated...reloading
page');

and then reload it.

So I now have the function:

function reloadInfoPage()
{
window.opener.parent.document.write('Contents
Updated...reloading page');
window.opener.parent.location =
window.opener.parent.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

Jul 23 '05 #1
2 4907


Snolly wrote:

function reloadInfoPage()
{
window.opener.parent.document.write('Contents
Updated...reloading page');
window.opener.parent.location =
window.opener.parent.location;
}


Try
var win = window.opener.parent;
var oldHref = win.location.href;
win.document.open();
win.document.write('Contents ...');
win.document.close();
win.location.href = oldHref;
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Thanks Martin, your solution works perfectly.

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sam | last post: by
4 posts views Thread by JesusFreak | last post: by
1 post views Thread by fogwolf | last post: by
3 posts views Thread by Tyrone Slothrop | last post: by
4 posts views Thread by tcole6 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.