The implementations of Page-Redirection are as follows:
Example 1:
In Java script we can simply do page redirect at client side. if any visitors visit the website then you can redirect your website visitors to new page , For that you just need to add an extra line in your head section of the code which is follows as:
<html>
<head>
<script type="text/javascript">
<!--
function Redirect() {
window.location="http://www.findnerd.com";
}
//-->
</script>
</head>
<body>
<p>Click the following button, you will be redirected to home page.</p>
<form>
<input type="button" value="Redirect Me" onclick="Redirect();" />
</form>
</body>
</html>
Example 2:
In Previous we are redirecting our visitors to a new page but before redirecting to new page if we want to display appropriate message, Then it would be possible via using **SetTimeout()**. In JavaScript **SetTimeout()** is a built-in function through which user can execute another function after some time of interval So the function will take given bit of delay to show the another function.
<html>
<head>
<script type="text/javascript">
<!--
function Redirect() {
window.location="http://www.findnerd.com";
}
document.write("You will be redirected to main page in 10 sec.");
setTimeout('Redirect()', 10000);
//-->
</script>
</head>
<body>
</body>
</html>
0 Comment(s)