title: Getting first visible iFrame within a window and printing it
body: <p>Kind of an absurd situation... This is only really only for IE8 and lower.</p>
  
  <p>Anyway I have an iFrame appearing (which I can't control  / create an ID for), appreciate it Telerik!</p>
  
  <pre><code>// The only way I can grab it specifically would be:
  var iframe = document.frames ? document.frames[id] : document.getElementById(id);
                                               // ^ you grab by ID in IE
  var ifWin = iframe.contentWindow || iframe;
  </code></pre>
  
  <p>But since I don't have the ID, I can't use this method...
  I've tried a few different methods, with no success.</p>
  
  <pre><code>// tried either window. / or document.
  document.frames.print();
  window.frames.print();
  document.frames[0].print();
  </code></pre>
  
  <p><strong>I basically just want to just, GRAB the first iFrame -> and print it</strong></p>
  
  <p><strong>Side note</strong>: <code>window.print()</code> works in everything besides IE8 &amp; lower. For IE, it prints only the outer / parent window content, instead of the iFrame that is currently focused on.</p>
  
  <p>Any thoughts?</p>
  
  <hr>
  
  <p><strong>Update:</strong> So somehow doing <code>window.frames[2].print()</code> in the <em>IE console</em> works (and grabs the correct frame). When I try to put this code in the Javascript, I have the exact same thing: <code>window.frames[2].print()</code>, IE interprets this code into <em>dot notation</em> <code>window.frames.2</code> and doesn't work and comes back as null or not an object. Typing that same dot notation into the console doesn't work and just gives me "Expected ;" (which makes no sense).</p>