View Full Version : Closing window

07-11-2003, 09:31 AM
hallo.. just a question... I've a script that closes a window after having runned a swf file.... the browser asks me if I want the application can close the window... is it possible not to have this confirm?? I want the window be closed without prompting me for confirmation....

thank you.....

07-11-2003, 11:04 AM
Try open that window using JavaScript. If you open that window with window.open() function, window.close() function will close it without promt. I think self.close will do the same.

07-11-2003, 12:25 PM
thanks for your answer,but it does not work...
I paste here the script so that you can help me....

<script language="JavaScript">
function launchwin(){
newwin = window.open("","flashcamwin","fullscreen=1,scrollbars=1")
var htmlString=.......

here there's the definition of the flash file that will be loaded.... then the scripts finishes as it follows....


and this is the body...... <BODY onLoad="launchwin()"></BODY>

????? what can I do?

07-11-2003, 01:14 PM
I had the same problem and this is how I solved it...

May not be the best way.

I open up a second window (full screen size) - most people wouldn't even notice that a new window has opened.
This page shows whatever was requested.

The page in the new window has a link "close" which runs the javascript onclick="window.close()"

Like i said maybe not what you're after but it works cleanly!

07-11-2003, 01:38 PM
This is cool.


<title>Self closing - No warning</title>
<script language="javascript">
var i = 0;

function closeMe() {
document.mainForm.myTime.value = 7-i;
if(i==7) { // wait five seconds
window.opener = top;

<form name="mainForm">
<font face="Arial, Helvetica, Sans-Serif" size="2">This window will close in
<input type="text" name="myTime" size=2> <font face="Arial, Helvetica, Sans-Serif" size="2">seconds.
<script language="javascript">

In the form section, simply place your content. Enjoy.