简体   繁体   English

一段时间后访问页面时自动刷新页面

[英]Auto refreshing the page when it is visited after some duration of time

Can it be possible to auto-refresh a page when visiting to its tab after some duration of time. 在一段时间后访问页面的标签时,是否可以自动刷新页面。 I am asking in the case of opening many tabs in the browser and the tab where our web page is running need to be auto-refreshed when coming back to it from the other tab 我问的是在浏览器中打开许多选项卡时,从另一个选项卡返回到该页面时,我们网页运行的选项卡需要自动刷新

You can try this . 你可以试试这个

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

Refresh document every 30 seconds: 每30秒刷新一次文档:

So try this . 所以尝试一下

or this . 或者这个 may solve your problem. 可能会解决您的问题。

Below code will do the trick 下面的代码可以解决问题

$(window).on('focus', function() { 
    /*your code*/
    setTimeout(function(){
        location.reload();//will reload your page
    },1000); //duration
}); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问页面时,自动单击页面上的锚链接 - Auto click an anchor link on the page when the page is visited Odoo-在特定视图上自动刷新页面 - Odoo - auto refreshing page when on specific view 当用户一段时间不活动(未注销但有一段时间没有访问该页面)时,如何删除Firebase数据库条目? - How to delete a Firebase db entry when user has been inactive for some time (not logged out, but hasn't visited the page in a while)? 在页面加载后一段时间执行 Javascript - Execute Javascript a duration of time after the page load 长时间未访问页面时,内容脚本会卸载 - Content script unloads when page is not visited for a long time 使用ajax过滤某些数据后刷新页面时获得相同的内容 - Getting the same content when refreshing a page after filtering some data with ajax 闲置一段时间后自动注销 - auto logout after some time of inactivity 隐藏某些元素后,为什么页面会刷新? - Why is my page refreshing after hiding some elements? AngularJS-更改状态后停止自动刷新页面 - AngularJS - stop auto-refreshing page when state is changed 浏览器问题,即执行某些操作时未刷新页面 - browser issue, ie is not refreshing the page when some action performed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM