Created
April 20, 2011 02:29
-
-
Save tracend/930226 to your computer and use it in GitHub Desktop.
Facebook JS-SDK: Check if the user has liked a page
This file contains hidden or 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
| FB.api({ method: 'pages.isFan', page_id: '{PAGE_ID}' }, function(response) { | |
| if (response) { | |
| alert("user has liked the page"); | |
| } else { | |
| alert("user has not liked the page"); | |
| } | |
| }); |
Same code i am using but its not wokring
You can see my whole code
window.fbAsyncInit = function() {
FB.init({
appId : '1100886646641860',
xfbml : true,
version : 'v2.6'
});
FB.Event.subscribe('edge.create',
function(href, widget) {
//alert('Ti piace ' + href);
//document.getElementById('fb-like').style.display = "none";
//var x = document.getElementsByTagName("button")[0].getAttribute("title");
// alert(x);
});
FB.api({ method: 'pages.isFan', page_id: '100012125951339' }, function(resp) {
if (resp) {
alert('You like it.');
} else {
alert("You don't like it.");
}
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
@rahulatoz This code not supported v2.6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same code but it's not working anymore for me.
I saw this working this few hours ago and now I always got 'false' as callback.
Any suggestion?