Tracking a child window of a different domain for unfocus/closing

Discussion in 'HTML & Website Design' started by Submerged, Jul 10, 2008.

  1. #1
    I'm not sure this is even possible, but I was hoping someone might know.

    Let's say I have a page (index.php) that opens a popup of google.com with typical javascript code. Is there any way for the parent window to know when the user either closes the popup or focuses on a different window?
     
    Submerged, Jul 10, 2008 IP
  2. Submerged

    Submerged Active Member

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    Also, this seems really simple but I'm having issues anyways, how would I have a button that would close the popup created by this code:?

    <script>
    MyNewWindow=window.open('http://www.mydomain.com/myfile.html', 'NameOfMyWindow');
    </script>

    I had this, but it's not working:

    <FORM>
    <INPUT type="button" value="Alert child!" onClick="NameOfMyWindow.close();">
    </FORM>

    Thanks again!
     
    Submerged, Jul 10, 2008 IP