title: Getting iframe document in Chrome
body: <p>I am trying to dynamically change the heigh of a iframe depending on it's contents.</p>
  
  <p>However it's not working in the latest version of chrome. </p>
  
  <p>doc is <code>'undefined'</code> in chrome.</p>
  
  <p>It works fine in Firefox.</p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>&lt;script&gt;
      $(function() {
  
          $('#iframeid')
                  .load(
                          function() {
  
                              try {
                                  var doc = this.contentDocument ? this.contentDocument
                                          : this.contentWindow.document;
                                  alert(doc);
                              } catch (e) {
                                  alert(e.message);
                              }
                          });
  
      });
  &lt;/script&gt;
  &lt;iframe frameborder="0" id="iframeid" src="iframesource2.html"
      height="1px"&gt; &lt;/iframe&gt;
  </code></pre>