Using JavaScript
i have the refresh button in my parent window,
when i click refresh button ,
i want to refresh my child window ,
window.location.href=’add_billing_order_frm.php?session_re_genrate=new
This snippet redirecting the page instead refresh ,
I thing there is a snippet like
opener.document.location.reload(true);
but this one for parent window refresh, but i want for child window wiht URL location option
function show_billing_order_form(url){
var childWindow = window.open(url);
}
function refresh_my_child_window(){
return childWindow.location.reload('add_billing_order_frm.php');
}
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..
When opening your child window from the parent, remember the return value in a variable somewhere:
…and when you want to refresh the child:
Note that some browsers will prevent access to
childWindow.location.reloadif the parent and child aren’t loaded from the same origin.Here’s a quick-and-dirty example (live copy — note: the live copy only works in non-edit mode, like the link given, because otherwise JSBin uses
null.jsbin.cominstead ofoutput.jsbin.comand so the origin doesn’t match):HTML:
JavaScript:
Caveat: I would never recommend hooking up event handlers with
onclickproperties as above. Instead, I’d useaddEventListener(on standards-based browsers) orattachEvent(on IE), by using a library or a utility function like this one. Used the properties above to avoid obscuring the main point.