...

View Full Version : Closing window



gattigher
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.....

Kor
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.

gattigher
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")
newwin.resizeBy(15,0)
var htmlString=.......

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

newwin.document.open();
newwin.document.write(htmlString)
newwin.document.close()

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

????? what can I do?

michael.hd
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!

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

<html>

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

function closeMe() {
i++;
document.mainForm.myTime.value = 7-i;
if(i==7) { // wait five seconds
window.opener = top;
window.close();
}
setTimeout("closeMe()",1000);
}
</script>
</head>

<body>
<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.
</SPAN></form>
<script language="javascript">
closeMe();
</script>
</body>
</html>

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum