At present, my site keeps automatically reloading the javascript function every 10 seconds. setInterval( "checklatestmsgidLive();", 10000 );I think that the function will continue to reload the function anyway, even when the user views another site in a different tab. How to make it reload the function only when the user browses my site? Can javascript be detected if a user browses my site?
I saw that the wall of facebook.com also updates new posts only when I view the page, when I am on a different tab, it will not update new posts. How to do it?
source
share