Most of the time we might need to reload or redirect the parent page once pop up page is opened or closed. Here I have place a simple javascript code using JQuery to reload or to redirect the parent page once pop up is closed or if you want to reload or refresh parent page from iframe page.
You have to download and include the jquery file to your project.
<script type=”text/javascript” language=”javascript” src=”url/jquery.js”>
<script type=”text/javascript” language=”javascript”>
//while pop-up page is opened
window.onload = function(e)
{
parent.refreshParent();
}
//while pop-up page is closed
window.onbeforeunload = function(e)
{
parent.refreshParent();
}
function refreshParent()
{
//location of parent page
parentWindow = window.opener.location.href;
//to refresh or reload uncomment the code below
//window.opener.location.reload();
//to redirect the page
window.opener.document.location.href = parentWindow;
//If you want to redirect to different page
//window.opener.document.location.href=”http://www.yourdomainname.com/otherpage”;
}
</script>
