title: Redirect from Facebook canvas page to website
body: <p>Is there a way to redirect from my Facebook canvas page to my external website?  I've seen blogs and stackoverflow answers of the form:</p>
  
  <pre><code>&lt;script&gt;
  window.top.location = 'http://www.yoursite.com/';
  &lt;/script&gt;
  </code></pre>
  
  <p>Unfortunately these kinds of solutions never work.  I've tried top.location.href, window.location and location.href as well.. nothing works.  Did Facebook remove the possibility to redirect from javascript by parsing out this kind of code?  Is there a way to still redirect?</p>
  
  <p><strong><em>UPDATE</em></strong>: What happens is the webpage acts like there was never a javascript redirect instruction.  And in fact, when I look at the source code through firebug I see no javascript redirects.</p>
  
  <p><strong><em>UPDATE 2</em></strong>: I get the following javascript errors form my canvas page when I try <code>window.top.location = 'http://www.yoursite.com/';</code> and the other variations above.  It seems Facebook doesn't allow access to the window, top or location global javascript variables:</p>
  
  <pre><code>Uncaught ReferenceError: a217374027657_location is not defined
  Uncaught ReferenceError: a217374027657_window is not defined
  Uncaught ReferenceError: a217374027657_top is not defined
  </code></pre>
  
  <p>Interestingly, <code>document.location = 'http://www.yoursite.com/';</code> works in that there are no exceptions... but of course the webpage doesn't get redirected.</p>
  
  <p><strong><em>UPDATE 3</em></strong>: Figured it out!  Javascript redirect only works with iframe canvases.  I had to change my settings in the advanced screen to use iframe instead of FBML.</p>