View Full Version : redirecting on a specific date and time
85882
03-17-2005, 04:23 PM
How can I redirect a page on a specific date and time?
Thank You!
Jon Hanlon
03-17-2005, 06:46 PM
function sendOff() {
var tTime = new Date("April 20, 2005 12:03:59");
var now = new Date();
if (now.getTime() >= tTime.getTime()) {
location.replace("http://www.newsite.com/newPage.htm")
} else {
window.setTimeout("sendOff()",1000) // re-check in 1 sec
}
}
You have to watch out for the difference between UTC time and local time.
85882
03-19-2005, 03:31 PM
The code doesn't work for some reason! :(
coothead
03-19-2005, 03:50 PM
Hi there 85882,
the code works OK. :D
Did you set it up like this...
<script type="text/javascript">
<!--
function sendOff() {
var tTime = new Date("march 19, 2005 20:59:59");
var now = new Date();
if (now.getTime() >= tTime.getTime()) {
location.replace("http://www.google.com/")
} else {
window.setTimeout("sendOff()",1000) // re-check in 1 sec
}
}
onload=sendOff;
//-->
</script>
_Aerospace_Eng_
03-19-2005, 03:56 PM
hmm nifty script there, does it matter if the month is capitalized?
EDIT: to answer your question Aero, no it doesn't :P
85882
03-19-2005, 03:58 PM
I don't think so, but thanks sooo much!..lol...i know I forgot about that! :D
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.