How to self refresh the main page while self. close the popup window?

Hello, I have the situation for upload picture in popup window, and when it is done, self close the popup window, and refresh the main window so that the uploaded picture’s name will shown on the main window. IS it possible to make and how ?

Thanks very much in advance and may u a nice week !!

No expert on js, but this should work:

// this is the popup: do all your uploading stuff here, then add:


<html><head>

<script>

function close_and_reload_parent()
{
	opener.location.href='url_to_reload';
	self.close();
}

</script>

<title><title></head>

<body onload="close_and_reload_parent()"></body></html>


change ‘url_to_reload’ to the one that you wanna redirect to…

you can change the body-tag with variables, so it doesn’t close until the POST is done

Hope it helps :slight_smile:

why?

That sound like an odd thing to do