none
window.opener.focus(); cross domain problem in IE

    Question

  • Hi

     

    I have a problem i would like to solve.

     

    A visitor on www.mywebsite.com is linked to www.anotherwebsite.com with a simple "<a href "and target="_blank". When this visitor close the www.anotherwebsite.com window the function below is called.

     

    <script language="javascript">
     window.onunload = function()
      {
      opener.document.focus();
     }
    </script>

     

    This works great in FF. But it only works with IE when the new child and parents location is on the same domain. To set focus with IE and the code above. The closing window and the opener window must use the same domain like www.mywebsite.com. I cant get this to work if the opener window is on www.mywebsite.com and the closing window is on www.anotherwebsite.com.

     

    I cannot set document.domain to make this work either cause of restrictions.

     

    How can i solve this problem?

    Thursday, May 15, 2008 11:35 AM

All replies

  •  

    I don't think you can get around this.  Its a rather draconian security measure that blocks cross domain abuses. 

     

    Try this in FF:-

     

    opener.close()

     

    Does FF allow the opened to close the original page?

     

     

     

    Friday, May 16, 2008 8:00 PM