如何每5秒重新载入一次页面? [英] How to reload page every 5 seconds?

查看:78
本文介绍了如何每5秒重新载入一次页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一种布局转换为html;一旦我在code/html/css中进行了更改,每次必须按F5.是否有任何简单的javascript/jQuery解决方案? IE.添加脚本后,每5秒钟(或其他特定时间)重新加载整个页面.

I am converting one layout to html; once I make the changes in code/html/css, every time I have to hit F5. Is there any simple javascript/jQuery solution for this? I.e. after I add the script, reload the whole page every 5 seconds (or some other specific time).

推荐答案

 <meta http-equiv="refresh" content="5; URL=http://www.yourdomain.com/yoursite.html">

如果必须在脚本中,请使用 setTimeout 喜欢:

If it has to be in the script use setTimeout like:

setTimeout(function(){
   window.location.reload(1);
}, 5000);

这篇关于如何每5秒重新载入一次页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆