页面定时刷新或自动跳转

Posted 随心佩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了页面定时刷新或自动跳转相关的知识,希望对你有一定的参考价值。

采用response对象的setHeader方法,实现页面的定时跳转或定时自更新。例如:

(1)response.setHeader("refresh","5");每个5s刷新一次

 (2)response.setHeader("refer","10;url=http://www.souhu.com");延迟10秒,自动重定向到网页http://ww.souhu.com

注意:与(1)(2)等价的html代码如下:

(3)<meta http-equiv="refresh"content="5"/>

(4)<meta http-equiv="refresh"content="10;url=http://ww.souhu.com"/>

以上是关于页面定时刷新或自动跳转的主要内容,如果未能解决你的问题,请参考以下文章