如何安排 IE 页面重新加载

发布于 2024-11-27 08:38:41 字数 64 浏览 0 评论 0原文

有没有一种机制可以用来强制页面每“n”分钟重新加载一次?我无法修改页面代码本身,“刷新”请求应该从页面本身外部发出

Is there a mechanism i can use to force page reload every 'n' minutes? I can't modify the page code itself, "refresh" request should be issued from outside of the page itself

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

遗忘曾经 2024-12-04 08:38:41
var timedRefresh = setTimeout(function(){location.reload(true)},1*60000)

这将每分钟刷新页面。如果您将其制作成greasemonkey的脚本,它将不断地被注入到页面中,并继续每分钟+加载时间执行一次。

另一种方法是按照建议将页面放入 iframe 中。例如

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);
}

,这仅在 Chrome 中进行了测试,innerHTML 可能会给 IE 带来一些问题。 (虽然不确定)

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)

与风相奔跑 2024-12-04 08:38:41

您可以尝试将网站放入 iframe 中,并通过 Javascript 按设定的时间间隔刷新该网站。

对于更简单的解决方案,根据您的实际需求,我使用以下网站进行类似的操作:

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

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

罪#恶を代价 2024-12-04 08:38:41

蠕动效果很好。将“cnn.com”替换为您需要重新加载的页面,将“10”替换为间隔(以秒为单位)

<!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>

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>
夜血缘 2024-12-04 08:38:41

试试这个:
此方法将每 1 分钟后重新加载页面

setInterval(function () {  window.location.reload(); }, 60000);

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

setInterval(function () {  window.location.reload(); }, 60000);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文