javascript - how to check whether user like my page or not using facebook JS SDK? -


i working in 1 facebook application going run outside facebook in 1 webpage having functionality of page, on bases of have redirect page on different pages,

i tried lots of code check whether user liked page or not failed.

so if 1 knows how check please me.

thanks in advance.

note : want using js sdk not php sdk.

to access data form facebook need user_likes permission.

<div id="fb-root"> </div> 
var page_id = 'your page / url id'; (function() {     var e = document.createelement('script');     e.type = 'text/javascript';     e.src = document.location.protocol +                     '//connect.facebook.net/en_us/all.js';     e.async = true;     document.getelementbyid('fb-root').appendchild(e); } ());  window.fbasyncinit = function() {     fb.init({ appid: 'your app id', status: true, cookie: true, xfbml: true, oauth: true });       fb.login(function(response) {         if (response.authresponse) {             fb.api('/me/likes/' + page_id, function(api_response) {                 try {                     if ((api_response.data[0].name) != undefined)                         alert(api_response.data[0].name);                     else                         alert('you not page');                 }                 catch (e) {                     alert('you not page');                 }             });         }     }, { scope: 'email,user_likes' }); }; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -