Reputation: 33
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
Upvotes: 1
Views: 839
Reputation: 1118
Below code will do the trick
$(window).on('focus', function() {
/*your code*/
setTimeout(function(){
location.reload();//will reload your page
},1000); //duration
});
Upvotes: 1
Reputation: 802
You can try this.
<meta http-equiv="refresh" content="30">
Refresh document every 30 seconds:
So try this.
or this. may solve your problem.
Upvotes: 1