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

**URL:** <https://forum.kirupa.com/t/how-to-self-refresh-the-main-page-while-self-close-the-popup-window/34440>\
**Category:** Uncategorized\
**Created:** [November 2, 2003, 1:49pm UTC](https://forum.kirupa.com/t/how-to-self-refresh-the-main-page-while-self-close-the-popup-window/34440 "2003-11-02T13:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SBUH](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@SBUH](https://forum.kirupa.com/u/SBUH)\
**Post date:** [November 2, 2003, 1:49pm UTC](https://forum.kirupa.com/t/how-to-self-refresh-the-main-page-while-self-close-the-popup-window/34440/1 "2003-11-02T13:49:13Z")

</div>

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 !!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2003, 11:08pm UTC](https://forum.kirupa.com/t/how-to-self-refresh-the-main-page-while-self-close-the-popup-window/34440/2 "2003-11-14T23:08:53Z")

</div>

No expert on js, but this should work:

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

```auto

<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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2003, 11:14pm UTC](https://forum.kirupa.com/t/how-to-self-refresh-the-main-page-while-self-close-the-popup-window/34440/3 "2003-11-14T23:14:58Z")

</div>

why?

That sound like an odd thing to do
