Last active
December 7, 2017 12:38
-
-
Save VinnyFonseca/5928111 to your computer and use it in GitHub Desktop.
Facebook Page Tab Like Gate
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
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