title: Why can a child redirect a parent frame?
body: <p>I have a look at these two questions and i don't understand.</p>
  
  <p><a href="https://stackoverflow.com/questions/580669/redirect-parent-window-from-an-iframe-action-using-javascript">Redirect parent window from an iframe action</a></p>
  
  <p><a href="https://stackoverflow.com/questions/369498/how-to-prevent-iframe-from-redirecting-top-level-window">How to prevent IFRAME from redirecting top-level window</a></p>
  
  <p>On one hand it appears that you can redirect the parent iframe and on the other you cannot?
  When i try it, I have no problem redirecting the parent frame so i'm curious as in why everyone say you cannot redirect parent frame unless you are on the same domain. But I can redirect without having the frame on the same domain.</p>
  
  <blockquote>
    <p>As stated previously, will redirect the parent iframe. One thing to bear in mind is that both the website, and the site contained in the iframe need to be on the same domain for this to work, or you'll get an access denied exception.</p>
  </blockquote>
  
  <p>Is it browser related?</p>
  
  <p>Edit</p>
  
  <p>I have two pages and this works but shouldn't :</p>
  
  <p>On domain 1</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;iframe src="http://domain2.fr"&gt;&lt;/iframe&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>On domain 2</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;script type="text/javascript"&gt;
        window.top.location.href = "http://google.fr";
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>