This is only possible with legacy APIs or with user_likes permission. Since you want a solution without specific permissions, I will show you 2 methods. Use them in conjunction with AJAX to refresh the page when the user clicks like .
Option 1) REST API
Using the deprecated API, you can use Pages.IsFan
https:
Do it in C # as follows.
var appID = "...."; var appSecret = "...."; var uid = "...."; var pageId = "...."; WebClient client = new WebClient(); var appAuthUri = string.Concat("https://graph.facebook.com/oauth/access_token?", "client_id=", appID, "&client_secret=", appSecret, "&grant_type=", "client_credentials" ); var response = client.DownloadString(appAuthUri); var access_token = response.Split('=')[1]; var isFanUri = string.Concat("https://api.facebook.com/method/pages.isFan?", "format=", "json", "&page_id=", pageId, "&uid=", uid, "&access_token=", access_token ); response = client.DownloadString(isFanUri); bool isFan; bool.TryParse(response, out isFan);
Option 2) Client side
FBXML Method. This is done using Javascript on the client, subscribing to the event when the user clicks the like button. He documented here .
How do I know when a user clicks the Like button?
If you use the version of the XFBML button, you can subscribe to the "edge.create" event through FB.Event.subscribe.
Create the FBXML button as here .
<div id="fb-root"></div> <script>(function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js#appId=132240610207590&xfbml=1"; d.getElementsByTagName('head')[0].appendChild(js); }(document));</script> <div class="fb-like" data-href="http://www.thecodeking.co.uk" data-send="true" data-width="450" data-show-faces="false"></div>
Then subscribe to the edge.create event using the Javascript SDK . Put this code in a BODY document, preferably just before it completes.
<script type="text/javascript"> <!-- window.fbAsyncInit = function () { FB.init({ appId: '245693305442004', status: true, cookie: true, xfbml: true }); FB.Event.subscribe('edge.create', function (href, widget) { </script>