title: Accessing the document object of a frame with JavaScript
body: <p>I'm testing on <a href="http://www.quackit.com/html/templates/frames/frames_example_1.html" rel="noreferrer">this page</a>, and I'm not sure what I'm missing.</p>
  
  <pre><code>// Two frames on the page
  &gt; document.getElementsByTagName("frame").length
  2
  
  // Same domain, so no security restrictions
  &gt; document.getElementsByTagName("frame")[0].src
  "http://www.quackit.com/html/templates/frames/menu_1.html"
  &gt; window.location.href
  "http://www.quackit.com/html/templates/frames/frames_example_1.html"
  
  // Can't access the document
  &gt; document.getElementsByTagName("frame")[0].document
  undefined
  </code></pre>
  
  <p>It seems like this should work, so what's the problem?  It needs to work in IE8, but I'm also testing in Chrome (newest stable).</p>