I am opening new pop-up page in new window. Now When I am pressing a html input button from child window, I want to close this child window then I want to refresh the parent window. How I can do using javascript?
Can you anyone suggest me the solution?
In the HTML markup of the Child page we need to place the JavaScript function RefreshParent which is called attached to the browser onbeforeunload event. Thus when the Child page popup window is closed the parent page is refreshed.
From a child window or a small window once opened, we can transfer any user entered value to main or parent window by using JavaScript. You can see the demo of this here. Here the parent window is known as opener. So the value we enter in a child window we can pass to main by using opener.
You just need to prefix “ window. opener. ” and write the same code that you will write in the parent window's HTML page to access its elements.
but function refreshing my child window.. When opening your child window from the parent, remember the return value in a variable somewhere: var childWindow = window.open (/* ... */); Note that some browsers will prevent access to childWindow.location.reload if the parent and child aren't loaded from the same origin.
To open a popup window (child window) , i used this show_billing_order_form call back , To refresh the child window , i add one refresh icon in my parent window , To refresh the child window , in that refresh icon onclick i called refresh_my_child_window ,
To open a popup window(child window) , i used this show_billing_order_form call back , To refresh the child window , i add one refresh icon in my parent window , To refresh the child window , in that refresh icon onclick i called refresh_my_child_window , but function refreshing my child window.. javascript.
Open child window using the script on your parent page (you already have it there). 2. Get rid of the code that checks if the window is closed or not. You don't need it, in any way. 3. When you are done with adding a new record from you child window call these statements:
try something like this:
function closeAndRefresh(){
opener.location.reload(); // or opener.location.href = opener.location.href;
window.close(); // or self.close();
}
you could try this in you child window:
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With