title: <iframe> javascript access parent DOM across domains?
body: <p>I control the content of an iframe which is embedded in a page from another domain. Is there any way for javascript in my iframe to make changes to the parent's DOM? </p>
  
  <p>For example, I would like to have my iframed script add a bunch of html elements to the parent DOM. This seems like a pretty tall order - thoughts?</p>
  
  <p><strong>Edit:</strong> There exists a technique called "<a href="http://www.ajaxify.com/run/crossframe/" rel="noreferrer">Fragment ID Messaging</a>" which might be a way to communicate between cross-domain iframes.</p>
  
  <p><strong>Edit:</strong> Also, Firefox 3.5, Opera, Chrome (etc) seem to be adopting the html5 <a href="https://developer.mozilla.org/en/DOM/window.postMessage" rel="noreferrer">"postMessage" api</a>, which allows secure, cross-domain data transmission between frames, iframes and popups. It works like an event system. IE8 supports this feature, apparently, which is perhaps a little surprising.</p>
  
  <p><strong>Summary:</strong> No, you can't directly access/edit the DOM of a page from another domain. But you <em>can</em> communicate with it, and it can co-operate to make the changes you want.</p>