# Close browser window

**URL:** <https://forum.kirupa.com/t/close-browser-window/4605>\
**Category:** flash\
**Created:** [August 14, 2002, 1:29pm UTC](https://forum.kirupa.com/t/close-browser-window/4605 "2002-08-14T13:29:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greenhouse](https://avatars.discourse-cdn.com/v4/letter/g/7c8e57/32.png) [@Greenhouse](https://forum.kirupa.com/u/Greenhouse)\
**Post date:** [August 14, 2002, 1:29pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/1 "2002-08-14T13:29:02Z")

</div>

is there a command that I can use to close the browser window as flash hits a certain frame?

---

<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 14, 2002, 3:10pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/2 "2002-08-14T15:10:18Z")

</div>

getURL(“javaScript:window.close()”);

---

<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 14, 2002, 3:55pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/3 "2002-08-14T15:55:59Z")

</div>

It olmost works, but now my browser gives a message :

"The webpage you are trying to watch is trying to close the window.  
do you want to close the window ‘yes’ , ‘no’ "

Is there a way to avoid this?

---

<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 14, 2002, 4:35pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/4 "2002-08-14T16:35:37Z")

</div>

not if it’s not a popup window.

---

<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 14, 2002, 7:16pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/5 "2002-08-14T19:16:59Z")

</div>

exact, the main browser will always pop up this alert if you try to close it via script (security reasons)

---

<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 14, 2002, 7:23pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/6 "2002-08-14T19:23:14Z")

</div>

Hey Eyez! Quoi de neuf en France? J’ai un peu le mal du pays ici… Ce qui me manque le plus, bizarrement, c’est un peu de pain et du camembert…

pom :\*(

---

<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 14, 2002, 10:13pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/7 "2002-08-14T22:13:29Z")

</div>

yep I will like 4th that it is just what happens with your browser there is nothing you can do about it I know it is very sad its ok dont cry. :\*(

---

<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 14, 2002, 11:03pm UTC](https://forum.kirupa.com/t/close-browser-window/4605/8 "2002-08-14T23:03:50Z")

</div>

thats too bad, but thanks for the help y’all.

---

<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 15, 2002, 1:32am UTC](https://forum.kirupa.com/t/close-browser-window/4605/9 "2002-08-15T01:32:42Z")

</div>

Greenhouse-  
Not to worry I have the solution for you! I use it on my website [http://cgonline.net](http://cgonline.net)

When you enter my website- a browser window opens that immediately launches a second browser window. This second browser window displays the website website in “Full Screen” mode. I then use this special script to close down the first browser window so when you exit the site you are not left with a “window behind a window”. This special script will close the window in IE5+ and NS4+ without a confirmation popup.

It has problems with AOL’s current browser. When executed to close the window it will actually close down the entire AOL program (it does not crash AOL, it closes AOL). My work around is a CGI program that detects the AOL browser and launches a different page.

I am going to eat dinner. When I am done I will post the script for you.

One question I have. Can anyone tell me how to post actual code without this forum converting it and making it invisible?

---

<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 15, 2002, 2:50am UTC](https://forum.kirupa.com/t/close-browser-window/4605/10 "2002-08-15T02:50:35Z")

</div>

Here it is as promised. It was developed by Rahul Mahajan who did a great job.

IE5+  
Place this in the body of your HTML page that points to your swf file (this is the key)-

\<object id=closeWin type=“application/x-oleobject” classid=“clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11”\> \<param name=“Command” value=“Close”\>  
\</object\>

I am not absolutely sure of the command to use in your Flash file to execute the “close window” but is should look something like this-

“closeWin.Click();launchwin()”

Netscape 4+  
Netscape only needs this to close a window

“javascript:self.close()”

The netscape command above may work in an AOL browser. I have not tested it. Good luck!

---

<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 15, 2002, 2:59am UTC](https://forum.kirupa.com/t/close-browser-window/4605/11 "2002-08-15T02:59:55Z")

</div>

For some reason the link did not appear in my previous post-

[http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2844&lngWId=2](http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2844&lngWId=2)

the man (Rahul) is a genius!
