Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-10-2004, 10:47 AM   PM User | #1
Candrias77
Regular Coder

 
Join Date: Jul 2002
Location: New Zealand
Posts: 127
Thanks: 0
Thanked 0 Times in 0 Posts
Candrias77 is an unknown quantity at this point
Refresh Another Window

I have a link on my site that opens a new window. When a use is finished with the new window, I would like it to close and refresh the page that opened it. I think that I could use something like:

window.windowname.reload();
window.close();

but how would I set the 'windowname' the original page?

Any other thoughts on how this could be better are also appreciated, I am not all that hot on javascript.

Thanks.
__________________
eTheory - the theory of revolution
Candrias77 is offline   Reply With Quote
Old 07-10-2004, 12:42 PM   PM User | #2
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
Is the close button in the parent or the new window?
Mr J is offline   Reply With Quote
Old 07-10-2004, 12:44 PM   PM User | #3
SlavaTT
New Coder

 
Join Date: Oct 2003
Location: Ukraine
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
SlavaTT is an unknown quantity at this point
Hi,

in IE - window.opener.location.reload(true)
or window.opener.open('your url',_self,'size and other options (optional)')

Slava
SlavaTT is offline   Reply With Quote
Old 07-11-2004, 04:17 AM   PM User | #4
Candrias77
Regular Coder

 
Join Date: Jul 2002
Location: New Zealand
Posts: 127
Thanks: 0
Thanked 0 Times in 0 Posts
Candrias77 is an unknown quantity at this point
Close & Refresh Button

Mr J, the close button is in the new window.
__________________
eTheory - the theory of revolution
Candrias77 is offline   Reply With Quote
Old 07-11-2004, 01:28 PM   PM User | #5
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
In the popup you could go

<script>
<!--
function close_me(){
opener.location="page.htm"
self.close()
}
//->
</script>

where page.htm is the name of the opener page
Mr J is offline   Reply With Quote
Old 07-12-2004, 08:46 AM   PM User | #6
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Should be:
Code:
function close_me(){
  if (opener && !opener.closed){ //make sure the opener window is still open
     opener.location.reload();
  }
  window.close(); //close popup
}
...
<input type="button" value="Close" onclick="close_me()" />
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:08 PM.


Advertisement
Log in to turn off these ads.