title: Is it possible changing DOM of an iframe from the parent frame (same document.domain)?
body: <p>I want a simple and light-weighted way of making cross-domain requests to my api address (<em>api.example.com</em>) which is a subdomain of my main domain (<em>example.com</em>).</p>
  
  <p>I've read A LOT about techniques and hacks to deal with XDRs and their incompatibilities with each used browser but XDR is still very complicated for me. I don't need a complete/complex solution as easyXDM, which I have implemented and worked perfectly.</p>
  
  <p>So, I decided to 'enable CORS' which solved the problem for modern Webkit and Gecko browsers. But as always, there is the IE (and in this case Opera too) which is not compatible with CORS yet. </p>
  
  <p>As I wanted to continue using jQuery AJAX methods, I searched for a solution that would allow XDR with jQuery methods. Then, I implemented a very nice solution by <a href="https://gist.github.com/benvinegar" rel="nofollow">benvinegar</a> which replaces jQuery.ajax() method and therefore all its dependent methods: <a href="https://gist.github.com/859940" rel="nofollow">https://gist.github.com/859940</a>. His script is based on the document.domain/iframe trick.</p>
  
  <p>Before calling the function proposed by Ben, I tested for CORS support with jQuery.support.cors (using jQuery 1.6.2). Everything is okay, working perfectly.</p>
  
  <p>The only thing I'm not happy with the above linked script is that I need to load the jQuery library from <em>api.example.com</em> and I don't want that. I've made a bundle of minified javascript libraries/plugins/scripts in one file which is used by <em>example.com</em>; that gives me me 2 options (for using jQuery in <em>api.example.com</em>): load the entire bundle again or load a non-cached version of jQuery only. I don't like either.</p>
  
  <p><strong>My question is:</strong> is it possible to change the DOM of an iframe from the parent frame when both frames have the same document.domain? If so, could I clone jQuery from <em>example.com</em> into the child-iframe (<em>api.example.com</em>)? How? Or I'm just being crazy about this and there is a better solution taking in consideration what I described?</p>
  
  <p>Thank you all in advance,
  Leonardo.</p>