Welcome to WebmasterWorld Guest from 54.147.236.192

Forum Moderators: open

Message Too Old, No Replies

JavaScript question

     

Xoc

3:55 pm on Nov 27, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 18, 2001
posts:1437
votes: 0


I have a page with a link that brings up a popup window. The popup window modifies a database. When the popup is closed, I need to refresh the original page (actually frame) to reflect the changes in the database. Can anyone tell me how to do this?
4:42 pm on Nov 27, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Would it work to use onUnload in the pop-up document to load the changed document in the target frame?

Will

4:46 pm on Nov 27, 2001 (gmt 0)

Inactive Member
Account Expired

 
 


In the popup window's onClose event:

opener.document.location=newURL;
or
opener.frames(frameIndex).document.location=newURL;

Xoc

5:14 am on Nov 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 18, 2001
posts:1437
votes: 0


Thank you! I didn't know about the opener object. My knowledge of JavaScript is spotty. This code worked great:

onUnload="opener.window.location.reload()"

6:35 am on Nov 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Opener is new to me as well. Neat!

I really should get around to taking a formal JavaScript course some day.

8:23 am on Nov 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 4, 2001
posts:1265
votes: 12


I have a question along the same lines...

I have a pop up remote control on a site that takes visitors through a tour of top reviews. The reviews are on various pages are are loaded in the parent window (using: opener.location.href=)

What I haven't been able to figure out (although I haven't tried very hard) is how to reopen the parent window on the off chance that someone closes it and then clicks another link in the remote.

The only thing I've tried so far is various permutations of: if opener == null which doesn't seem to work.

I suppose I could just assign the parent a target name and then use <a href target=""> instead of javascript but that doesn't give me as much control over the parent window without having to rewrite everything.

Anyone have any ideas?

4:03 pm on Nov 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


window.opener is a property of the pop-up window, so it will not be null just because the opener window was closed.

How about testing with if window.opener.closed?

3:52 am on Dec 7, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 4, 2001
posts:1265
votes: 12


That worked... Thanks much... (.closed) wasn't mentioned in any of the references I checked.