I want to know if the user has focus on the http or https.
So everytime the user clicks on one of the childwindows - i want to know which one is "active".
I checked the W3C. The Page Visibility API
Is there a way to detect if a browser window is not currently active?
But for me it only was working with tabs but not windows.
EDIT: And only tested on the Parentwindow.
Any Help?
Thanks in advance.
Here is what i got.
<html>
<head>
    <title>checkfocus</title>
</head>
<body>
<a href="javascript:loadChild()">Click me</a>.
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
    var w;
    var w2;
    function loadChild() {
        w = window.open("","",'width=400,height=200');
        w.location.href="https://www.facebook.com";
        w.moveTo(0,0)
        w.addEventListener('focus',function(){
            console.log("w")
        })
        w2 = window.open("","",'width=400,height=200');
        w2.moveTo(400,0)
        w2.location.href="http://www.facebook.com";
        w2.addEventListener('focus',function(){
            console.log("w2")
        })
    }
</script>
</body>
</html>
the Events is fired 2 times in chrome one time when the window is opened and one time location.href is set... but nothing afterwards
 
     
    