[英]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
我问的是在浏览器中打开许多选项卡时,从另一个选项卡返回到该页面时,我们网页运行的选项卡需要自动刷新
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.