Refresh parent window from child window using javascript
I am opening new pop-up page in new window. Now When I am press开发者_开发技巧ing 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?
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();
}
I tried code
window.close();
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
Its working..
window.location.reload();
reloads the parent window.
document.opener.document.location.href = document.opener.document.location.href
Just try this simple code:
// parentPage.php is the parent page you want to redirect and refresh.
window.opener.location.href="parentPage.php";
self.close();
The right expression to reload the parent window with a button within an iframe:
parent.location.reload();
This function worked for me:
function closeAndRefresh(){
opener.location.href = opener.location.href;
window.close();
}
精彩评论