Javascript Redirect Overview

When you want to move a web page to a new location, perhaps a new domain, there are a number of ways to take your web site visitors to the new location. One of the simplest to implement is the javascript redirect. It has the advantages of being independent of the web server and requiring minimal coding skills to implement.

Javascript window.location Code

In javascript the command to implement a redirect is window.location = New URL. The code to add to your HTML on the web page is as below, for the fastest response the code should be added inside the HEAD tag

<script type="text/javascript">
window.location = "";

The code above redirects from the page it is on to - to implement the code on your own site change the to your destination URL.

The following link shows an example of an immediate javascript redirect in action:

Add More Complexity

For more complex situations - for instance conditional redirects or timed redirects additional code is required in your javascript script block.