Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I auto close a web page after 5 seconds?

Status
Not open for further replies.

Usalabs1

Technical User
Jun 29, 2003
131
US
I'm using a java chat server, but being the logout confirmation page is in html, and it opens as a seperate window with the login window behind it, is it possible to auto close the confirmation window after a set time? Without windows asking for closing confirmation.
 
Code:
 Insert the onLoad event handler into your BODY tag 

<BODY onLoad="setTimeout(window.close, 5000)">

adjust the time to suit from 5000 to whatever.



Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
The code works, but windows still asks if I want to close the window.

Is there an addition to the code to prevent windows asking to close the window?
 
This will close the window with no warning in 5 seconds but only works in IE
Code:
<html><head><script>
function bye() {
  self.opener=this;
  setTimeout(this.close, 5000);
}
</script>
</head>
<BODY onLoad="bye()">
Test
</body>
</html>
Hope it helps.

Glen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top