rootpanthera
rootpanthera

Reputation: 2771

Close dialog when "fb like" is clicked

I have jquery dialog on my website. It pops up when page is loaded. I want to give my dialog facebook functionality (like button).

Now I want to:

  1. Dismiss dialog right after "Like" is clicked.
  2. I don't want to show dialog if the user already "Liked" the page.

Please note I don't have any application ID associated with my page (when it comes back). Any ideas?

Thank you!

Upvotes: 0

Views: 101

Answers (1)

Hüseyin BABAL
Hüseyin BABAL

Reputation: 15550

There is no way to do that because of Same Origin Policy. You can only do that with FB API like;

FB.api('/me/likes/your_page_id', {limit: 1}, function(response) { 
        if (response.data.length == 1) {
            // User already liked your page, do not open dialog
        } else {
            // $("#dialog").dialog(); User not liked your page           
        }
});

For detect when user click, you can use;

FB.Event.subscribe('edge.create',
     function(response) {
          // User clicked like button
     }
);

You can create FB App here

Upvotes: 1

Related Questions