English 中文(简体)
如何每5秒重载一页?
原标题:How to reload page every 5 seconds?

我将一个布局转换为html;我一旦修改法典/html/cs,我每次都不得不打F5。 是否有简单的javascript/jQuery解决办法? I.e. 在我添加文字之后,每5秒(或其他一些具体时间)上载整页。

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

如需在文字中使用。 如:

setTimeout(function(){
   window.location.reload(1);
}, 5000);
问题回答

为了重载同一页,你不需要第二点。 你可以公正地利用:

 <meta http-equiv="refresh" content="30" />

这可每30秒重载一次。

在3秒后,汽车重载和清晰切身可轻易使用javascript Interval功能。 这里简单的法典

$(document).ready(function() {
  setInterval(function() {
    cache_clear()
  }, 3000);
});

function cache_clear() {
  window.location.reload(true);
  // window.location.reload(); use this if you do not remove cache
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<p>Auto reload page and clear cache</p>

也可为此使用美加元

<meta http-equiv="Refresh" content="5">

@jAndy提供的答复应当奏效,但可在<>>Firefox<>>上回答,您可能面临问题,window.place. place.reload(1);这或许不能奏效,这符合我的个人经验。

因此,我建议:

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

测试和操作标准。

http://xrefresh.binaryage.com/“rel=“nofollow noreferer” XRefresh plugin。 每当发现档案经过修改时,该档案将重新上载。 因此,除了在你的超文本编辑中外,这只是每5秒复读一次。

或者,有“LiveReload

如果您正在发展中和测试,则可以提供“ReloadEvery,允许你在规定的间隔内重新上上载。

这将在5个地方开展工作。

5000毫秒=5秒<>

www.un.org/Depts/DGACM/index_spanish.htm 用目标加以使用 或你想要的东西和你想要的东西:

<script type="text/javascript">
function load()
{
setTimeout("window.open( http://YourPage.com ,  _self );", 5000);
}
</script>
<body onload="load()"> 

www.un.org/Depts/DGACM/index_spanish.htm 或者,通过自动自食其力,没有目标代码,你想要哪一页,包括自己:。

<script type="text/javascript">
function load()
{
setTimeout("location.href =  http://YourPage.com ;", 5000);
}
</script>
<body onload="load()"> 

www.un.org/Depts/DGACM/index_spanish.htm 或者,如果仅重载并瞄准你想要的东西:。

<script type="text/javascript">
function load()
{
setTimeout("window.open(self.location,  _self );", 5000);
}
</script>
<body onload="load()">

所有3个国家都以不同的方式做了类似的事情。

function reload() {
  document.location.reload();
}

setTimeout(reload, 5000);




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.