|
Ever wondered how some web sites
take you from one page to another without you clicking a single
mouse button? If so, you're in for a treat because here is how they
do it.
It's called Redirecting and most web builders use it to
direct visitors from Splash pages to Home pages, or to direct visitors
to pages that have been moved. There are a couple of ways to do
this, one way is to use the META Refresh command and another
is to use the onLoad event handler.
META Refresh
Place this code between the <HEAD> </HEAD> tags of
your document.
<META http-equiv="refresh" content="10; URL=http://yoursite.com/homepage.html">
The content=" " command does two things. It tells the browser how
many seconds to wait before executing the refresh, and then what
url it should be redirected to.
onLoad
Place this attribute inside the <BODY> tag of your document.
onload=setTimeout("location.href='http://yoursite.com/homepage.html",10000)
The downside to using the META Refresh command is that the
time starts counting down when the document starts loading - this
is not good especially when your visitors are viewing your web pages
with a slow Internet connection. With onLoad, time starts counting
down when the page has finished loading.
Also, META Refresh works with seconds (10) and onLoad
works with milliseconds (10000) - 10 seconds is equal to 10000 milliseconds.
One last word of advice
Always make sure you include a link to the refresh page in case
your site's visitors don't want to wait to get to the other page
or in case their browser doesn't recognize your code.
See it in action
|