J'ouvre la nouvelle page pop-up dans une nouvelle fenêtre. Maintenant, lorsque j'appuie sur un bouton d'entrée html de la fenêtre enfant, je veux fermer cette fenêtre enfant, puis je souhaite actualiser la fenêtre parentale. Comment puis-je utiliser en utilisant javascript?
Pouvez-vous me suggérer la solution?
Essayez quelque chose comme ceci:
function closeAndRefresh(){ opener.location.reload(); // or opener.location.href = opener.location.href; window.close(); // or self.close(); }
Vous pourriez essayer cela dans votre fenêtre enfant:
function refreshParent() { window.opener.location.href = window.opener.location.href; if (window.opener.progressWindow) { window.opener.progressWindow.close() } window.close(); }
J'ai essayé le code
window.close(); if (window.opener && !window.opener.closed) { window.opener.location.reload(); }
Ça marche..
window.location.reload();
Recharge la fenêtre parentale.
document.opener.document.location.href = document.opener.document.location.href
Essayez simplement ce code simple:
// parentPage.php is the parent page you want to redirect and refresh. window.opener.location.href="parentPage.php"; self.close();
La fonction ci-dessous a fonctionné pour moi.
function closeAndRefresh(){ opener.location.href = opener.location.href; window.close(); }