468,133 Members | 1,250 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

issue with refreshing pages using JavaScript.

48
We have an issue with refreshing pages using JavaScript.
We have got three pages. From page 1, page 2 is opened by window.open and from page 2, page 3 open up by window.open and also closes page 2. Now on submitting page 3, can we refresh page 1 ?
Is there any method to do this using JavaScript ?
Apr 4 '08 #1
8 1251
gits
5,390 Expert Mod 4TB
i think you just have to pass the reference to the windows ... in win2 you have the refernce to the opener as:

Expand|Select|Wrap|Line Numbers
  1. // declare that globally in your win2
  2. var orig_opener = window.opener;
  3.  
now you could use that in win3 with:

Expand|Select|Wrap|Line Numbers
  1. var orig_opener = window.opener.orig_opener;
  2.  
now you have the reference to win1 stored in orig_opener.

kind regards
Apr 4 '08 #2
hsriat
1,654 Expert 1GB
That's possible. Do it like this.

File a.htm[html]<h1>File A</h1>
<button onclick="window.open('b.htm');">Open B</button>[/html]
File b.htm[html]<h1>File B</h1>
<button onclick="window.open('c.htm');">Open C</button>[/html]
File c.htm[html]<h1>File C</h1>
<script>
var w = window.opener.opener;
window.opener.close();
</script>
<button onclick="w.location.replace('a.htm');">Refresh A</button>[/html]


Harpreet


[EDIT: Sorry Gits, I didn't see your post before posting]
Apr 4 '08 #3
gits
5,390 Expert Mod 4TB
:) no problem ... no need to apologize ... may be your post makes it a bit more clear in case the OP wouldn't know how to use the opener ...

kind regards
Apr 4 '08 #4
hsriat
1,654 Expert 1GB
:) no problem ... no need to apologize ... may be your post makes it a bit more clear in case the OP wouldn't know how to use the opener ...

kind regards
Well, if that would be the case, I'll take my sorry back. :D

Regards
Apr 4 '08 #5
CF FAN
48
ok big thanksss. this thing we have tried as u post. it is perfect in this case.thankssss...........


now we have the problem with more than 3 windows opening. So need to know if we can set a name for the first page and then reference it.
Apr 7 '08 #6
gits
5,390 Expert Mod 4TB
just pass the reference to every new opened window as we showed you ...

kind regards
Apr 7 '08 #7
kunal pawar
297 100+
on 3rd page just use javascript code window.opener.location.reload();
Apr 9 '08 #8
CF FAN
48
ok Thanks ..working fine
Apr 10 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Mr. x | last post: by
31 posts views Thread by Greg Scharlemann | last post: by
8 posts views Thread by -Karl | last post: by
3 posts views Thread by Purti Malhotra | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.