Skip to content

Instantly share code, notes, and snippets.

@obense
Created March 19, 2015 14:07
Show Gist options
  • Save obense/ea27583c421ea65ebbd4 to your computer and use it in GitHub Desktop.
Save obense/ea27583c421ea65ebbd4 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
function NotInFacebookFrame() {
return top === self;
}
function ReferrerIsFacebookApp() {
if(document.referrer) {
return document.referrer.indexOf("apps.facebook.com") != -1;
}
return false;
}
if (NotInFacebookFrame() || ReferrerIsFacebookApp()) {
top.location.replace("####MY_FACEBOOK_TAB_LINK####");
}
</script>
@Pierstoval
Copy link

Simplifiable:

<script type="text/javascript">
    if (top === self || (document.referrer && document.referrer.indexOf("apps.facebook.com") != -1)) {
        top.location.replace("####MY_FACEBOOK_TAB_LINK####");
    }
</script>

😈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment