Home Advanced Code Automatic Redirection

Automatic Redirection

E-mail Print PDF
Have you ever wanted to redirect your visitors to another website? Like for instance - if your website moved from a free site to your own domain name. Of course, you could put a simple hyperlink on your old page, but that doesn't guarantee people will go to your new page.

One option is to simply jump to the new page as soon as the old one loads. To do this you can put the instructions in the old page's <body> tag like this:

Code:
<body onload="window.location = 'http://yourwebsite.com';">
Change yourwebsite.com with your website address.

You may want a small delay before the redirection occurs. For example, you may have a notice about the change of address, on your old page, you want people to read first. Put this simple script in the <head> section of the page you are jumping from.

Code:
<script language="JavaScript">
var id=setTimeout("location.href='http://yourwebsite.com'",4000);
</script>
Change yourwebsite.com with your website address.

The url after location.href should be the page to redirect to.
4000 is the delay (in milliseconds) before the redirection occurs. Change this to whatever you want.

 

Domain Names

Sample image .com .info
.mobi .net
.org .tv .us
.biz .ws .name
.am .at .be .cc .cn .de .eu
.fm .jobs .jp .ms .nu .nz
.tc .tw .uk .vg .ASIA .ME

Website Hosting

Sample image We're the affordable, reliable place to host your site. And unlike the competition, there's no set up fee and no annual commitment.

24/7 Support

Sample image Our highly trained, courteous support staff is waiting to help. We'll resolve any issue to your complete satisfaction.