HTML Implementation
<head> <!-- Refresh current page ONLY --> <meta http-equiv="refresh" content="10"> <!-- Redirect to other page after counting down --> <meta http-equiv="refresh" content="5; url=hello.html"> </head>
JavaScript Implementation
<script>
// Instant redirect
window.location.href='hello.html';
// Redirect when time up
setTimeout("javascript:location.href='hello.html'", 5000);
</script>JavaScript Implementation (w Counting Down)
<span id="totalSecond">5</span>
<script>
var second = document.getElementById('totalSecond').textContent;
if (navigator.appName.indexOf("Explorer") > -1) {
second = document.getElementById('totalSecond').innerText;
} else {
second = document.getElementById('totalSecond').textContent;
}
setInterval("redirect()", 1000);
function redirect() {
if (second < 0) {
location.href = 'hello.html';
} else {
if (navigator.appName.indexOf("Explorer") > -1) {
document.getElementById('totalSecond').innerText = second--;
} else {
document.getElementById('totalSecond').textContent = second--;
}
}
}
</script>Solve Firefox not Support innertext
<span id="totalSecond">5</span>
<script>
if(navigator.appName.indexOf("Explorer") > -1){
document.getElementById('totalSecond').innerText = "my text innerText";
} else{
document.getElementById('totalSecond').textContent = "my text textContent";
}
</script>