我如何刷新每X秒的JavaScript浏览器? [英] How do I refresh the browser every X seconds with javascript?

查看:86
本文介绍了我如何刷新每X秒的JavaScript浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Firefox的插件,可以刷新浏览器窗口每X秒。作为一个前端开发者,这是非常有用的,因为我可以得到的CSS / XHTML即时反馈在我的编辑更改一刻,我救他们。

我已经注意到然而,这经常停止工作。我猜这可能是因为,我已经加入到与插件干扰页面的JavaScript / jQuery的。

我只是想知道是否有可能增加JavaScript的一个临时线路需要时模仿这种自动刷新的行为。


解决方案

 的setTimeout(location.reload(真);,timeoutPeriod);

I use a Firefox plugin that can refresh the browser window every X seconds. As a frontend developer this is really useful as I can get instant feedback on CSS / XHTML changes the moment I save them in my editor.

I've noticed, however, that this often stops working. I'm guessing this may be due to javascript/jQuery that I've added to the page interfering with the plugin.

I was just wondering if it was possible to add a temporary line of javascript to mimic this auto-refresh behaviour when needed.

解决方案

setTimeout("location.reload(true);", timeoutPeriod);

这篇关于我如何刷新每X秒的JavaScript浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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