|
This javascript page redirect can be used to redirect the visitor
from one page to another. The javascript page redirect is particularly useful
for people when they have removed pages from their website
and people may have bookmarked the page or search engines
still hold links to the old web page. Instead of
them receiving an "Error 404 page can not be found" you can add the
javascript page redirect code below to the head of an old web page and visitors will be redirected
to a new web page specified in the javascript. The person viewing the old web page will never even know they have
been redirected to the new page.
<script language="javascript">
<!--
location.replace("http://www.x-lab.co.uk/");
//-->
</script>
When using the javascript page redirect you can use the setTimeout
function to allow the web page to be displayed for a set period of
time before the javascript loads the new web page. Adding a delay to the
page redirect javascript is ideal if you want to let your visitors know that the
web page has been moved and they should update their bookmark
list accordingly.
<script language="javascript">
<!--
window.setTimeout('window.location="http://www.x-lab.co.uk/"; ',4000);
// -->
</script>
An important note which you need to consider when using the
javascript page redirect, not all browsers have javascript enabled
so always provide a link to the new web page in the BODY of the document
so at least they can click through to the correct page rather
than solely relying on the javascript page redirect.
Javascript Page Redirect
Simply click inside the window below, use your cursor to highlight
the javascript, and copy [Control]+C the javascript into a new file in
your text editor (such as Note Pad) and save [Control+S].
|