Hi Guys,
Is it possible to code an Html page to auto close after 5 seconds after it loads up?
Regards,
Gav
Hi Guys,
Is it possible to code an Html page to auto close after 5 seconds after it loads up?
Regards,
Gav
I cannot see any viable use for this except as a popup script, but
where 5 is the number of seconds you wish to close the pageCode:<body onload="javascript:setTimeout(window.self.close(), 5*1000);">
Many browsers will not allow that.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
That was great - Thanks a lot - except for that popup asking for confirmation to close - can that be avoided by any chance so the window closes on its own without notice
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
You can spoof some browsers into thinking that the window was opened by javascript, but not all. Those that can be fooled will stop popping the confirmation question (note - some won't ask to begin with, just won't close the window). You could (if your set up lends itself to this strategy) actually open the window with javascript to begin with. Then, virtually any browser that will allow it to open in the first place, will allow it to close. However, many browsers will block it as a pop up, or if they have javascript disabled, not open it to begin with. In some tabbed browsers, a situation could arise where the entire browser closes, or attempts to close.
Generally it's not nice to mess with windows, stick to the documents.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
HTML Code:<script type="text/javascript"> function fullClose() { window.opener=self; window.close(); } window.onload=function() { setTimeout(fullClose,5000); } </script>
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Marvelous
You guys got the brains - I really appreciate your help- that's exactly what I was looking for - Thank you John and Tech Support - I love you guys for the time every one in this forum puts in to help us
- Not to forget Blizz thanks for being there all the time mate, you are my guardian angel I should say
*********** Tech Support, Please check why my photo is not showing up besides my name - I had uploaded it yesterday **********
Last edited by gavinv3; 10-28-2007 at 02:25 PM.
Bookmarks