A JavaScript redirect can be used to redirect a visitor from one webpage to another. This could be your site moving to a new domain. Some download sites have a time delay during redirections, which is basically the JavaScript redirect in action. If you are having some external servers mirror your site for you, you would need JavaScript redirect.

Implementing the JavaScript Redirect

First open up your HTML page (most often the index.html) and within the tags, place the following code:

<script type="text/javascript">
<!-- window.location = "http://www.byteguide.com" //-->
</script>

Note that “http://www.byteguide.com” should be replaced with the URL that you want to redirect your visitors to.

Downsides of JavaScript Redirects

As the name suggests, a JavaScript redirect requires the user to have JavaScript enabled. While keeping JavaScript enabled is the common practice nowadays, there is still that odd user that will have it off. In that case, the JavaScript redirect would not work. This is because of the users’ concerns regarding their security, their browsers not supporting JavaScript, or because the search engine crawlers cannot execute the JavaScript redirection codes.