Time delay in url redirection may be useful for the following conditions:
- Refresh a web page in every specified seconds.
- For displaying an "Update you Bookmark" page when a page Url has ben changed.
The html and JavaScript code for url redirection with delay is given below:
<html>
<head>
<script type="text/javascript">
function delayedRedirect(){
window.location = "/default.aspx"
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>You'll be redirected soon!</h2>
</body>
</html>
More...
Currently rated 5.0 by 3 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5
Time delay in url redirection may be useful for the following conditions:
- Refresh a web page in every specified seconds.
- For displaying an "Update you Bookmark" page when a page Url has ben changed.
The html and JavaScript code for url redirection with delay is given below:
<html>
<head>
<script type="text/javascript">
function delayedRedirect(){
window.location = "/default.aspx"
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>You'll be redirected soon!</h2>
</body>
</html>
The JavaScript function setTimeout is the most important part of the code given above. setTimeout function calls delayedRedirect function after 3 seconds (3000 miliseconds).
You may find the details of setTimeout() method in JavaScript setTimeout Function - JavaScript Timing Events
Currently rated 4.3 by 4 people
- Currently 4.25/5 Stars.
- 1
- 2
- 3
- 4
- 5