更新时间:2023-12-02 11:27:46
请看我对这个问题的评论。请在此处查看使用setTimeout
的说明:
http://***.com/questions/4644027/how-to-automatically-reload-a-page-after- a-given-period-of-inactivity [ ^ ]。
(只是忽略不活动时期的方面并显示鼠标/键盘绑定代码。)
完整的答案取决于刷新的目的;一般情况下,还有其他方法。通常,自动刷新是为了实现 pull技术,这是一件坏事,是由于缺少服务器推送。
请参阅我过去的答案和下面引用的文章:
http:// en。 wikipedia.org/wiki/Pull_technology [ ^ ],
http://en.wikipedia.org/wiki/Server-push [ ^ ],
网站帐户的应用程序仪表板 [ ^ ]。-SA
Please see my comment to the question. Please see the explanation of the use ofsetTimeout
here:
http://***.com/questions/4644027/how-to-automatically-reload-a-page-after-a-given-period-of-inactivity[^].
(Just ignore the aspect of "period of inactivity" and the mouse/keyboard binding code shown.)
The full answer depends on the purpose of your refresh; in general case, there are other methods. Typically, auto refresh is done to implement pull technology, which is a bad thing, a result of the lack of server push.
See my past answer and the article referenced below:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Server-push[^],
Application 'dashboard' for website accounts[^].—SA