Tuesday, 19 July 2011

Redirect a Page with time delay using JavaScript

Many times we need to redirect  from one page to another webpage with some delay. Doing this using JavaScript is very easy.
Just  Create a simple HTML page using this code and change the form action and view in browser.

<script type="text/javascript">
function delay()
    window.location = "http://anurag-tutorial.blogspot.com" 
<body onLoad="setTimeout('delay()', 5000)">
<h2>Redirecting to Programming Tutorial !</h2>
<p>You are about to go to Programming Tutorial page after time delay!</p>

When you test it in your browser yow will see that you will be redirected to Programming Tutorial page in after a delay time.