Looking for cheap and reliable hosting with CPanel? Look no further!
Check out MochaHost now, they are the host you're looking for!
Delayed Redirection
Published on: 2005-08-15 - Views: 5369
You just found the answer.
With a simple javascript function you can send your visitors to another page, allowing them some time to read a message on the actual page.
You only have to add the function definition in your <head>tag and then recall the function in your <body> tag.
Let's see it in depth;
this is the code you have to put into your head section:
<script language="JavaScript">
var destination = "http://www.tutorialstream.com";
function goTo()
{
setTimeout( "window.location.href = destination", 10*1000 );
}
</script>
The variable destination has to contain the url where you want your visitors to be sent; 10*1000 means 10 seconds so if you want to make them wait 5 secs you simply have to type there 5*1000.var destination = "http://www.tutorialstream.com";
function goTo()
{
setTimeout( "window.location.href = destination", 10*1000 );
}
</script>
Now that we have written our function we have to recall it in the body tag in this way:
<body onload="goTo()">
You can use this script to redirect your visitors when you show them an error page.You can use this combined to the .htaccess custom error page (see the tutorial here) to redirect our users to the home page once they try to reach a page that doesn't exist.
Are you getting enough traffic?
Make your website stand out from the crowd, reach the top positions in search engines.
Visit High Quality Links now!

