Skip to content

Instantly share code, notes, and snippets.

@VinnyFonseca
Last active December 7, 2017 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VinnyFonseca/5928111 to your computer and use it in GitHub Desktop.
Save VinnyFonseca/5928111 to your computer and use it in GitHub Desktop.
Facebook Page Tab Like Gate
var appId = 'XXXXXXXXXXXXXXX';
// Taken from the App's configuration page
window.fbAsyncInit = function() {
FB.init({
appId: appId,
status: true,
cookie: true,
xfbml: true
});
FB.Canvas.setAutoGrow();
};
FB.getLoginStatus(function(response) {
if (response.status == "connected") {
FB.api("/me", function(user) {
if (user != null) {
FBID = user.id;
PageID = "XXXXXXXXXXXXXXX";
// Taken from http://graph.facebook.com/PAGE-NAME [app parent page]
FB.api("/me/likes/" + PageID, function(response) {
if( response.data[0] ) {
IsFan = true;
// Action code here
} else {
IsFan = false;
return false;
}
});
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment