PDA

View Full Version : Automatically close a popup after delay



AlistairH
08-05-2005, 01:11 PM
I'm using window.open to open a page in a new popup window. I'd like the window to automatically close after 30 seconds. I presume I need to use the setTimeout function but not sure.

Any ideas?

Twey
08-05-2005, 01:46 PM
var popup = window.open("popup.htm");
setTimeout("popup.close()", 30000);

AlistairH
08-05-2005, 02:10 PM
Great Twey!

I stared at this for ages and never got close to such a simple solution. Talk about not seeing the wood for the trees....

Thanks.

Twey
08-05-2005, 04:21 PM
Heh, no problem. Sometimes it just needs a different viewpoint.