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
Asked
Active
Viewed 788 times
1
-
bind a variable to window.onblur and then use wondow.onfocus to check for that variable and refresh the page – Pete Jul 31 '15 at 11:04
2 Answers
1
You can try this.
<meta http-equiv="refresh" content="30">
Refresh document every 30 seconds:
So try this.
or this. may solve your problem.

Community
- 1
- 1

Nikunj Chotaliya
- 802
- 8
- 19
-
1I need to refresh the page only after the visit of its tab, not continuously after the time interval thanks anyway – Bimal Bhandari Jul 31 '15 at 11:01
1
Below code will do the trick
$(window).on('focus', function() {
/*your code*/
setTimeout(function(){
location.reload();//will reload your page
},1000); //duration
});

Vidyadhar
- 1,088
- 9
- 15