[javascript] How to tell if browser/tab is active