Problem
What must I do to have a function on a website that claims to reroute you to the site in 3 seconds or less?
Asked by codedude
Solution #1
<meta http-equiv="refresh" content="3;url=http://www.google.com/" />
Answered by Darin Dimitrov
Solution #2
Most likely, you’re seeking for the meta refresh tag:
<html>
<head>
<meta http-equiv="refresh" content="3;url=http://www.somewhere.com/" />
</head>
<body>
<h1>Redirecting in 3 seconds...</h1>
</body>
</html>
Note that while using meta refresh is deprecated and frowned upon these days, it is sometimes the only viable alternative (for example, if you can’t generate HTTP redirect headers server-side and/or you need to support non-JavaScript clients).
Answered by LukeH
Solution #3
You can use javascript instead of the meta tag if you want more control. This would allow you to have some sort of display, such as a countdown.
Here’s how to use setTimeout in a very basic way ()
Answered by mbrevoort
Solution #4
Here’s a thorough (yet simple) example of refreshing a counter div while redirecting after X seconds:
The counter div’s initial content is the number of seconds to wait.
Answered by noamtm
Solution #5
The simplest method is to use the HTML META element, which looks like this:
<meta http-equiv="refresh" content="3;url=http://example.com/" />
Wikipedia
Answered by Ehsan
Post is based on https://stackoverflow.com/questions/3292038/redirect-website-after-specified-amount-of-time