Forum Moderators: coopster

Message Too Old, No Replies

window auto close

         

adamnichols45

11:06 am on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any handy script that will atomatically closing a window say within 5 seconds with out prompting the user?

eelixduppy

12:24 pm on Oct 26, 2006 (gmt 0)



This is done with javascript:

setTimeout("window.close()",5000);

Hope this helps :)

justgowithit

2:26 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



Keep in mind that the javascript window.close() function will only perform effectively on pop-ups that you spawn.

adamnichols45

11:09 pm on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



no i wont the actualy main browser window to close automatically without prompting the use - i dont mind what language i have to use to acomplish this

eelixduppy

2:34 am on Oct 27, 2006 (gmt 0)



The code that I posted above closes the window that it resides in. I'm by no means a guru with JavaScript, so someone please correct me if I'm giving wrong advice ;)

IamStang

11:37 am on Oct 27, 2006 (gmt 0)

10+ Year Member



Using the JS method eelixduppy proposed above (on the main browser window):

In IE6, you will be prompted that the script is trying to close the browser and asked if you want to allow it to close.

In FireFox and Netscape 7, it does nothing.

In Opera 8 and 9, it closes the current viewing tab regardless of if it is the only one open or not.

Hope it helps!
IamStang