title: How can an iFrame from another domain get rid of itself?
body: <p>I am building a bookmarklet for various sites that functions basically like this:</p>
  
  <ol>
  <li>User navigates to foo.com (an external site not on my control)</li>
  <li>User clicks a bookmarklet on his browsers that grabs some information from foo.com and displays it on a form in bar.com inside an iframe</li>
  <li>User submits the form inside bar.com which is inside foo.com</li>
  <li>The iframe dissapears</li>
  </ol>
  
  <p>The problem is getting the iFrame to remove itself. Since I can't access a function inside a parent domain in another domain I cannot create a custom function parent.removeIFrame() or even do a window.top.location.reload(). I tried many techniques but all of them fail because of cross domain scriptings.</p>
  
  <p>The way I solved it was to change the top.location.href to a custom page I built at bar.com/back.html in which all it does is simply to send a single "history.back()" command that bounces the user on the original page. Althought creative, I don't think it's  very elegant solution. Is there a better way?</p>