Can JavaScript detect onblur() for a window opened through window.open()?
<p>What I'm looking to do is create a new window using <code>window.open</code> and then when the new window opens, I want to check if that window is active throughout? </p>

<p>For example: I have</p>

<pre><code>myNewWindow = window.open(document.getElementById("inputbox").value).focus();
</code></pre>

<p>Once this window opens, I want to increment the value of variable increase if <code>myNewWindow</code> loses focus.</p>

<p>I'm doing :</p>

<pre><code>if(myNewWindow.onblur()){
    increment value...
}
setTimeout('myNewWindow.close()',3000); // closing window after 3 seconds. So, I'm really trying to check if the window was in focus for those 3 seconds.
</code></pre>

<p>However, the <code>onblur</code> does not seem to work no matter what I try. but, window does close.
Any ideas anyone? I just need to find out if the new opened window was minimized or some out of focus.</p>

<p>Its fairly easy to detect if the window in which you are running your JS is losing focus or not. And the same does not seem to work in my case. For example: <a href="http://stackoverflow.com/questions/3479734/test-if-window-has-focus">test if window has focus</a> </p>
