title: Accessing iframe from chrome extension
body: <p>I'm developing a chrome extension and bumped into a big problem.</p>
  
  <p>I'm using content scripts to inject my javascript code on a web site. The web site has an iframe.
  I can change the source code of the iframe but don't seem to get any access to the iframe's contentWindow property. I need it to insert text at the current carret position.</p>
  
  <p>So basically this code works perfectly in the context of the page:</p>
  
  <pre><code>$("#iframe1").contentWindow.document.execCommand("InsertHTML", false, 'test text');
  </code></pre>
  
  <p>But when I try it to run in the context of my chrome extension I get this error:</p>
  
  <pre><code>TypeError: Cannot read property 'document' of undefined
  </code></pre>
  
  <p>What's strange is that I can access the html of the iframe. So this code works perfectly from the chrome extension:</p>
  
  <pre><code>$("#iframe1").contents().find('div').html('test')
  </code></pre>
  
  <p>I tried putting "all_frames": true in the manifest file but no luck :(</p>