There are several methods by which we can achive auto-redirection.
1) The "Meta Refresh Tag" method:
It is believed that redirection using Meta Refresh Tag keeps the search engine happy as long as there is a reasonable delay between landing page and the page to which it is being redirected. In general at least 5 seconds is recommended. The Meta Refresh Code must be within <head> section.
The syntax for the "refresh" meta command is
<meta http-equiv="refresh" content="N; URL=other-web-address">
The "content" parameter contains two parts, seperated by a semi-colon.
The first part is the delay measured in seconds, before the redirection occurs.
And the second part is the URL to which it will redirect. Just like any hyperlink. It can be a relative URL or an absolute URL.
Note that for search engine optimization a delay of 0 (zero) seconds is not recommended.
Suppose if I want to redirect this page to http://arjudba.blogspot.com after 5 seconds then my meta tag refresh method will look like,
<meta http-equiv="refresh" content="5; URL=http://arjudba.blogspot.com">2) The "Javascript" method:
A small JavaScript code can be used to use redirect to another page. This Javascript code can be placed to anywhere in the page but it is better to use it in head section so that it runs as soon as the page begins to load. A simple example is below.
<html>With above Javascript After 5000 milliseconds (5 seconds) the page will be automatically redirected to http://arjudba.blogspot.com in the same window if JavaScript is enabled in the browser.
<head>
<script language="javascript" type="text/javascript">
window.setTimeout('window.location="http://arjudba.blogspot.com/";',5000);
</script>
</head>
<body>
<a href="http://arjudba.blogspot.com">Arju</a>
</body>
</html>
If we want new site will be displayed in a new window then JavaScript code will be,
<html>We can also write JavaScript code and then may want to load it from a HTML section. For example following JavaScript code and then onLoad from <body> section will do the work.
<head>
<script language="javascript" type="text/javascript">
window.setTimeout('window.open("http://arjudba.blogspot.com/")',5000);
</script>
</head>
<body>
<a href="http://arjudba.blogspot.com">Arju</a>
</body>
</html>
<HTML>Related Documents
<script>
function autoChange()
{
var timeID = setTimeout("location.href= 'http://arjudba.blogspot.com'", 5000)
}
</script>
<BODY onLoad="autoChange()">
Arju
</body>
</HTML>
http://arjudba.blogspot.com/2009/12/scrolling-text-effect-html-code-with.html
http://arjudba.blogspot.com/2009/12/open-link-in-new-window-or-in-new-tab.html
http://arjudba.blogspot.com/2009/09/html-special-character-reference.html
http://arjudba.blogspot.com/2009/07/css-margin-with-example.html
No comments:
Post a Comment