Last active
December 28, 2015 23:29
-
-
Save gowthamsadasivam/7579322 to your computer and use it in GitHub Desktop.
Facebook tab app redirect for the canvas page using Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) { | |
//it's a mobile device check we're inside an iFrame or not | |
if (top == self) { | |
//Not in iFrame redirect to application URL | |
top.location = "https://www.facebook.com/MyPage/?sk=app_xxxxxxxxxxx&ref=ts"; | |
} | |
} else { | |
//NOT a mobile device check we're inside an iFrame or not | |
if (top == self) { | |
//Not in iFrame redirect to application URL | |
top.location = "https://www.facebook.com/MyPage/app_xxxxxxxxxxx"; | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment