How to schedule IE page reload

半城伤御伤魂 提交于 2019-12-01 14:38:58
var timedRefresh = setTimeout(function(){location.reload(true)},1*60000)

That will refresh the page every minute. If you make it into a script for greasemonkey it will continually be injected into the page and keep executing every minute + load time.

ANother way is to, as suggested, put the page in an iframe. e.g.

if (self == top){
document.body.innerHTML = '<iframe id="meh" src="' + location.href + '" width="100%" height="100%">';
var t = setInterval("document.getElementById('meh').src = location.href", 1000);
}

That has only been tested in Chrome however, and innerHTML may pose some problems with IE. (not sure though)

You could try putting the site within an iframe and refreshing that via Javascript at set intervals.

For a more simple solution, depending on your actual needs, I have used the following site for something similar:

http://www.lazywebtools.co.uk/cycler.html

The wollowing works well. Replace "cnn.com" with the page you need to reload and "10" with the interval in seconds

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" />
  <meta http-equiv="PRAGMA" content="NO-CACHE" />
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />

  <title>Some title</title>
  <meta http-equiv="REFRESH" content="10" />
</head>

<body>
  <iframe src="http://www.cnn.com" frameborder="0" scrolling="no" style=
  "width:100%; height:100%;"></iframe>
</body>
</html>

Try this : this method will reload the page after every 1 minute

setInterval(function () {  window.location.reload(); }, 60000);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!