Play sound only in one window of which is active (within one website) using javascript (possibly jquery)
<p>Alright, I've found a bunch of answers concerning native functions like window.onblur and window.onfocus... But they won't help so I'd like to be more specific</p>

<ol>
<li>Say you open several tabs of one website</li>
<li>Say you receive a message and there's a sound to announce the message</li>
<li>As you have several tabs opened, you will hear the sound the number of opened tabs. Which makes a how'd'u'callit symphony</li>
</ol>

<p>Best solutions I've found so far, but which don't work
1. window.onfocus and window.onblur
2. Play sound if <strong>var infocus</strong> evaluates to true, don't play if not
3. It is crossbrowser
4. It is simple 
5. It does not work</p>

<p>Why the best solution won't work? Say you switch focus to another tab of a different website, your website loses focus so you won't hear the sound. Even worse, say you switch to another program, then the browser itsel loses focus and you won't hear the sound</p>

<p>So what shall I do?</p>
