Check if user liked page | Javascript | Facebook


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script src="http://connect.facebook.net/en_US/all.js"></script>
  2. <script>
  3. FB.init({
  4. appId : 'APPID',
  5. status : true, // check login status
  6. cookie : true, // enable cookies to allow the server to access the session
  7. });
  8.  
  9. FB.api({ method: 'fql.query', query: 'SELECT uid FROM page_fan WHERE uid=UID AND page_id=PAGEID' },
  10. function(result) {
  11. if (result.length){
  12. //is fan
  13. }
  14.  
  15. else {
  16. //is not fan
  17. }
  18. })

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.