title: js redirect if not in fb iframe
body: <p>i want to redirect all traffic going to my Facebook app tab on my server directly to my Facebook app. Therefore I check with the following code if the user is inside the Facebook iframe or on my webpage:</p>
  
  <pre><code>&lt;!-- language: lang-js --&gt;
  function referrerIsFacebookApp() {
      if(document.referrer) {
          return document.referrer.indexOf("facebook.com") !== -1;
      }
      return false;
  }
  
  if (!referrerIsFacebookApp()) {
      top.location.replace("https://www.facebook.com/bommelME/app_264697733636385");
  };
  </code></pre>
  
  <p>If I open up the page with the browser everything works as it should. But if I link to this page and open the link the redirect doesnt work. Any hints?</p>