Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.