|
||
CATEGORIES Home Getting Started HTML Cheat Sheet Webmaster Tools HTML Help Forum Color Codes Link to us |
||||
Why? The automatic redirect enables you to place a small code on your web page, and it will automatically go to another internet address in a set amount of time. The most common use of this script is when someone gets a new address for his or her web page. They can place a redirect code on there old site, so when visitors visit the old web site, it will automatically redirect to the new address. How To Do It There's 2 ways of redirecting, either automatically, or in a set amount of time, here's how to do both. Redirecting Automatically When redirecting to another address, it's a good idea to use a combination of three methods, JavaScript, meta refresh, and a plain old link, this looks like this: <script language="javascript"> What this does First, a JavaScript script will try to REPLACE the redirecting page with the new address. The reason you want it to try to REPLACE the page instead of redirecting it, is because it wont break the back button. Meaning, if it redirects to a new address instead of replacing it, if you where to hit the back button in your browser once you've been redirected, you will go back to the redirecting page, and the redirecting page will redirect you back to the new address. It will just turn into a big circle. So instead, it will REPLACE the page, so when you hit the back button on your browser, it will send you to the last page you visited. Next, just incase your visitor has JavaScript turned off in there browser, a META Refresh tag will fire. If for some unknown reason neither the JavaScript, or the META Refresh work, a link to your new web page will be displayed. How to edit this code Basically all you have to do is replace all 3 of the http://www.yournewsite.com to the actual address of the page your trying to redirect to. Redirecting in a set amount of time If you want to redirect in a set amount of time, you can use a meta refresh tag, like this. <meta http-equiv="refresh" content="0; url=http://www.yournewsite.com"> Just replace the http://www.yournewsite.com with the actual address of the page you want to redirect to. Next, change the 0 to the number of seconds you want it to take before the page refresh's. For example, if you place a 10 in place of the 0, when you visit the page with this code on it, once the page loads, it will wait 10 seconds, and then refresh to the new address. Note: If you are redirecting to a new web site, its a good idea to leave a message with your new internet address. The reason I say this is errors do come up, and just incase for some unknown reason the meta refresh tag doesn't work, you will have a message with a link to your new web site. Privacy Policy | Trademark Notices | User Agreement © 2001 TheHTMlSource.com, INC. All Rights Reserved. |