Reputation: 1568
I need a cross-browser javaScript code (if possible) that detects when entering a browser's tab (crossing from current opened tab to another tab) and refresh its page when the change was made.
Upvotes: 0
Views: 1089
Reputation: 5711
Window events can be in handy. So you can react to the blur and focus events, so leaving your browser tab will cause blur event and returning back - focus event.
$(window).focus(function(){
//refresh your page here
});
Upvotes: 1