homepage Welcome to WebmasterWorld Guest from 54.205.207.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
JavaScript question
Xoc

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 17 posted 3:55 pm on Nov 27, 2001 (gmt 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?

 

tedster

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



 
Msg#: 17 posted 4:42 pm on Nov 27, 2001 (gmt 0)

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

Will

10+ Year Member



 
Msg#: 17 posted 4:46 pm on Nov 27, 2001 (gmt 0)

In the popup window's onClose event:

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

Xoc

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 17 posted 5:14 am on Nov 28, 2001 (gmt 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()"

tedster

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



 
Msg#: 17 posted 6:35 am on Nov 28, 2001 (gmt 0)

Opener is new to me as well. Neat!

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

IanKelley

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 17 posted 8:23 am on Nov 28, 2001 (gmt 0)

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?

tedster

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



 
Msg#: 17 posted 4:03 pm on Nov 28, 2001 (gmt 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?

IanKelley

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 17 posted 3:52 am on Dec 7, 2001 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved