- You have a new and updated content and you want to redirect your users there.
- You want to introduce some time delay to grab user's attention and then redirect him/her to a specific webpage.
- You have got yourself a new domain name.
window.location = "http://www.botskool.com/";
If you want to introduce a time delayed redirect then use the following script -
<title>Sample Webpage to be redirected</title>
window.location = "http://www.botskool.com";
<body onLoad="setTimeout('redirect()', 5000)">
<h2>Redirecting in 5 seconds!</h2>
Notice the setTimeout() function it takes two arguments - first one is a function name and the second one is time delay in milliseconds after which it should execute the function mentioned in first argument. Here in this script setTimeout() waits for 5000 milliseconds i.e. 5 seconds before executing redirect() function which in turn redirects the page.