Welcome to WebmasterWorld Guest from 107.20.5.156

Forum Moderators: open

Message Too Old, No Replies

JavaScript question

     

Xoc

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

WebmasterWorld Senior Member 10+ Year Member



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

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

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



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)



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)

WebmasterWorld Senior Member 10+ Year Member



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

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

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



Opener is new to me as well. Neat!

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

IanKelley

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

WebmasterWorld Senior Member 10+ Year Member



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

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

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



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

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

WebmasterWorld Senior Member 10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month