refresh用于刷新与跳转(重定向)页面
refresh出现在http-equiv属性中,使用content属性表示刷新或跳转的开始时间与跳转的网址
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="5;url=http://www.w3school.com.cn">
<title>Title</title>
<script type="text/javascript">
window.onload = function () {
var i = 4;
var tim = document.getElementById("timers");
var timer = setInterval(function () {
if (i == -1) {
// window.location.href="http://blog.youkuaiyun.com/kill_bugs";
clearInterval(timer);
} else {
tim.innerHTML = i;
--i;
}
}, 1000);
}
</script>
</head>
<body>
<p>
对不起。我们已经搬家了。您的 URL 是 <a href="http://www.w3school.com.cn">http://www.w3school.com.cn</a>
</p>
<p>您将在 <span class="timeShow" id="timers">5</span> 秒内被重定向到新的地址。</p>
<p>如果超过 5 秒后您仍然看到本消息,请点击上面的链接。</p>
</body>
</html>