View Full Version : automatic redirect


horse*chica
04-19-2004, 06:19 PM
I've been hosted and would like to redirect visitors to my new url. What is the script that you can place on your site that redirects, while the visitor is told "You will be redirected in [#] seconds..."? Thanks a lot :)

kittycat
04-19-2004, 09:00 PM
http://javascript.internet.com/navigation/countdown-redirect.html

wazaaaa
04-19-2004, 09:04 PM
here u are :) (you can change the borders' and background colors of the input box where the dynamic text is to see just the plain number)

<p><form name="redirect">
<center>
<font face="Arial"><b>You will be redirected to the script in<br><br>
<form>
<input type="text" size="3" name="redirect2">
</form>
seconds</b></font>
</center>

<script>
<!--

/*
Count down then redirect script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

//change below target URL to your own
var targetURL="http://javascriptkit.com/script/script2/countredirect.shtml"
//change the second to start counting down from
var countdownfrom=5


var currentsecond=document.redirect.redirect2.value=co untdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>

wazaaaa
04-19-2004, 09:18 PM
oops, i posted just after kittycat, as i can't edit my previous message i post this simpler code made by me here:
<html><HEAD>
<SCRIPT language="JavaScript">
<!--
alert("You will be redirected to Lissa Explains it All Forum in 10 seconds");
setTimeout('getgoing()',10000);
//-->
</SCRIPT>
<SCRIPT language="JavaScript">
<!--
function getgoing()
{
window.location="http://www.lissaexplains.com/forum/";
}
//-->
</SCRIPT>
</HEAD></html>

an alert pops up, and 10 seconds after you press ok it redirects you to the specified page