title: Change top window location from iframe
body: <p>Hello I want to redirect my Facebook App page to another app page using php and javascript</p>
  
  <p>I have</p>
  
  <pre><code>echo "&lt;script type='text/javascript'&gt;
  if(window.top.location.href.toLowerCase().indexOf('http://apps.facebook.com/app1/') != -1) {
      window.top.location.href = 'http://apps.facebook.com/app2/2/';
      alert("Done");
  }
  else
     alert(window.top.location.href); 
  &lt;/script&gt;";
  </code></pre>
  
  <p>But I get an error:</p>
  
  <p><code>Unsafe JavaScript attempt to access frame with URL <a href="http://apps.facebook.com/myapp/?ref=bookmarks" rel="nofollow">http://apps.facebook.com/myapp/?ref=bookmarks</a> from frame with URL <a href="http://mydomain.com/?ref=bookmarks" rel="nofollow">http://mydomain.com/?ref=bookmarks</a>. Domains, protocols and ports must match.</code></p>
  
  <p>Is it possible to redirect from the Facebook Application iFrame without any problem?</p>