|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Does anyone know the code for, If you close the popup window then the parent window that made the popup will refresh?
|
|
#2
|
|||
|
|||
|
Here is a code that refresh parent window and closes the the popup in one operation.
Code:
<script language="JavaScript">
<!--
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
}
//-->
</script>
|
|
#3
|
|||
|
|||
|
try this
well i am using this script on my popup.asp page
<body onunload="opener.location=('page.asp')"> where "page.asp" is the page that you want to be refreshed when ur popup window closes. hope this will prove helpful regards Sumeet
__________________
the coolest one |
|
#4
|
||||
|
||||
|
To reload a window you can use the location method reload(). This method is handy because you don't need to know the name of the window you wish to refresh.
e.g. window.opener.location.reload() |
|
#5
|
|||
|
|||
|
Quote:
It works fine! Is there any way that the data in the parent page is not lost while reloading? Expecting this solution for ASP.Net. |
|
#6
|
|||
|
|||
|
you can assign the variables to hidden fields, then on the refresh assign them back out. or just use IsPostBack.
|
|
#7
|
|||
|
|||
|
Question
I'm new to using JavaScript so my question is in regards to where this code is to be placed: on the parent or child page? Also, is there a function call that needs to be made to initiate the script?
|
|
#8
|
|||
|
|||
|
Hi every one!
i have a window which open a popup... which further open another popup and close it self but the parent remain open and the newly created popup do somestuff and close itself... i want to refresh the opened Parent from the third window... i hope you understand it thanks in advance |
|
#9
|
|||
|
|||
|
I've been using this script on a site for about a year but about a month ago it stopped working. It will close the pop-up but not refresh the parent. I've tried it in a bunch of different browsers and platforms but it won't work anywhere. Does anyone know what might have happened? It's really strange. The parent page will just churn for a while like it's trying to do something but it never gets anywhere. It seems like it's trying to refresh, anyway, and there's some connection between the pages.
Any suggestions would be appreciated. |
|
#10
|
||||
|
||||
|
snowgurl:
What does your code look like? they may something strange sopping it from working. EiSa: I realize this post is very old and chances are none of the original posters still read this thread... but I have to get this off my chest =) A function named "refreshParent" shouldn't close the parent as well... I would deem that out of scope of refreshing. Perhaps rename the function to "closeRefreshParent" or something... Yes the example should work as given and perhaps I'm being picky about the name he/she chose for the function... This is a general complaint to common programming pratices and not a direct bashing of EiSa's example. There, I said it =) |
|
#11
|
|||
|
|||
|
Sorry I didn't see your reply sooner -- I didn't check back here to see if someone answered until now.
I just today figured out what was wrong. I had the correct code on the popup page -- just as you have here. The problem was on my link to the popup. I had "#" in there for the link for the javascript calling the popup. So, when it was trying to refresh it was looking for update?MemberID=647# -- and it couldn't resolve it. I put in "javascript: void(0)" for the link and it's working fine now. It is strange, though, that it worked for a long time with the "#" in there but all of a sudden stopped. Goofy. Oh, well ... it works now. I hope this helps someone else and saves them from going crazy some day. |
|
#12
|
||||
|
||||
|
Good stuff, thanks for the update!
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
|
#13
|
|||
|
|||
|
Quote:
Hi, i have almost the same case, and i assigned the variables using javascript, but on refresh i lost them, and i have to keep if !ispostback how can i assign them again.. shall i do it just after the refresh ? does it work this way.. thanks |
|
#14
|
|||
|
|||
|
Quote:
but if you are working on a master page, that has content place holder you gonna have to refresh your page using window.location.href = window.location.href |
|
#15
|
|||
|
|||
|
Thanks!
Thank you for this thread! Unintentionally and years after the original post, you all solved my problem. And not like you would expect, either. I also had working code that just "quit". I was about to implement one of the answers on here when I found a line in my code I had forgotten about that was causing the problem. Oh Thank You! I was getting SO tired of staring at non-working code with no clue what was going on. You just don't know how tired. Thanks.
|
|
#16
|
|||
|
|||
|
Quote:
But this doesn't refresh whole page, if it is contained with few frames. In my case, from master page (index.php) that is cntained with 3 frames, from one frame it is opened a popup window. When this popup window closes, it refresh only that frame, not the whole page. how can i make him reload whole page index.php? thx |
|
#17
|
|||
|
|||
|
Quote:
I have solved my problem by using this. Thank You... |