# Closing A Window After Opening One

**URL:** <https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746>\
**Category:** Uncategorized\
**Created:** [August 18, 2003, 1:37am UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746 "2003-08-18T01:37:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)\
**Post date:** [August 18, 2003, 1:37am UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746/1 "2003-08-18T01:37:08Z")

</div>

I have a question about a javascript code that should be simple.

1. (HTML PAGE), I have on a page where it says the requirements needed to view the flash site. There is a text button that says ‘Launch Site’, now whats the code that I have to put in it, then when it does launch the site, it closes the requirements page?

---

<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:** [August 18, 2003, 3:49pm UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746/2 "2003-08-18T15:49:30Z")

</div>

if you new page is a popup, you should never close the index page  
[edit] java and javascript are 2 very different languages[/edit]

---

<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:** [August 18, 2003, 4:19pm UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746/3 "2003-08-18T16:19:01Z")

</div>

Yea you’re right. I mean javascript, whatever. Yes, my new page is a popup. And exactly why should I not close the index? Maybe cause if the people close the new window by accident?? Is that what you’re saying?

---

<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:** [August 18, 2003, 5:33pm UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746/4 "2003-08-18T17:33:16Z")

</div>

yup, what if they close the window and can’t get back to your site

---

<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:** [August 18, 2003, 6:27pm UTC](https://forum.kirupa.com/t/closing-a-window-after-opening-one/28746/5 "2003-08-18T18:27:48Z")

</div>

Don’t you want to keep it open but replace it with another, so that when the user closes the pop-up the chance is given to open it again (from the other page). But anyways.

In the \<\*\*head\> section, place:

```auto

< **SCRIPT language="Java** Script">
function openclose()
{
 your_window = window.open("http://ww**w.whatever.com/pagetoopen.html","yourwindow","status=0,width=500,height=200");
self.opener = null;
self.close();
}
<**/SCRIPT>

```

And use this for the link:

```auto

< **a href="java** script:openclose()" **>Launch<** /a>

```
