Aguardando o carregamento da janela filho para concluir

Existe um gancho fácil para detectar que uma janela aberta por um script terminou de carregar? Basicamente, eu quero o equivalente doonLoad() gancho, mas eu não posso configurá-lo diretamente - suponha que o documento filho é um dado e eu não posso realmente colocar qualquer código meu dentro dele.

Por exemplo, digamos que eu tenha os dois arquivos a seguir:

parent.html:

<html>
  <head>
    <title>Parent</title>
  </head>
  <script type="text/javascript">
    var w;
    function loadChild() {
      w = window.open();
      w.location.href="child.html";
      // block until child has finished loading... how?
      w.doSomething();
    } 
  </script>
</html>
<body>
  I am a parent window. <a href="javascript:loadChild()">Click me</a>.
</body>

child.html:

<html>
  <head>
    <title>Child</title>
  </head>
  <script type="text/javascript">
    function doSomething() {
      alert("Hi there");
    }
  </script>
</html>
<body>
  I am a child window
</body>

Como a configuração location.href é não-bloqueante,w.doSomething() ainda não está definido e odoSomething() chamar explode. Como posso detectar que a criança terminou de carregar?

questionAnswers(3)

yourAnswerToTheQuestion