Redirect to a New Page
If you’re looking for a way to redirect your visitors to a new page, this JavaScript redirect code may be your answer.
Many times, when designing your web site, you may need to move a page to another location on your web server. However, you must find a way to redirect your visitors to the new page, as if you don’t, they will leave your web site and may never return.
In addition, the Search Engines may have already indexed your page. If you don’t use a redirect code to send your Search Engine traffic to your new page, again, you may lose these visitors forever.
For these reasons, using a redirect code is of the utmost of importance. Not only will this redirect code enable you to provide your visitors with the information they’re looking for, but it will also prevent you from losing your visitors.
Note: When using this JavaScript redirect code, please ensure that you don’t use it to trick the Search Engines, as this could get your web site banned. It is always best to learn and use quality tactics to drive traffic to your web site.
Place the following JavaScript redirect code between the <HEAD> and </HEAD> tags of your HTML code.
This example is setup to redirect to another page in 2 seconds. When a page contains this JavaScript, it will be redirected to another page that you specify in the “window.location=”. You can change the number of refresh seconds by changing the “move()’,2000 to the number of seconds you’d like.
Example:
1000 = 1 second
3000 = 3 seconds
Place this code between the <head> and </head> tags
<script language=”JavaScript”> <!–Script courtesy of http://www.web-source.net – Your Guide to Professional Web Site Design and Development var time = null function move() { window.location = ‘http://www.yourdomain.com’ } //–> </script> |
Place this code in your <body> tag
<body onload=”timer=setTimeout(‘move()’,2000)”> |