title: Adding an event listener to an iframe
body: <p>Is it possible to add an event listener to an iframe? I've tried this code, but it doesn't seem to work: </p>
  
  <pre><code>document.getElementsByTagName('iframe')[0].contentWindow.window.document.body.addEventListener('afterLayout', function(){
                  console.log('works');
              });
  </code></pre>
  
  <p>I've also just tried using getting the element by id and adding my listener via the JavaScript framework I'm using, like this: </p>
  
  <pre><code>Ext.fly("iframeID").addListener('afterLayout', function(){ alert('test'); });
  </code></pre>
  
  <p>I can call functions in the iframe, so I don't think security is an issue. Any ideas? </p>