English 中文(简体)
Hide content from non-fans in a Facebook *IFrame* (Not FBML)
原标题:

it is incredibly easy to hide content from someone who does not like your application...if you re using FBML. I m using an iFrame and the JavaScript SDK, and am having terrible difficulty figuring this out.

The behavior I m seeing (both logged in and out) is that does not seem to be supported by FB.XFBML.parse(). Am I mistaken or is there an alternative method I can use that does not require the user to give explicit permission?

最佳回答

Finally figured it out!

After you have initialized the api (using FB.init()) simply do the following:

FB.api( /mypage , function (response) {
    FB.api({ method:  pages.isFan , page_id: response.id },
        function (response) {
            alert(response);
        });
});

When the /mypage response comes back, it has the page id of the profile. Use that in the pages.isFan call and it will return a boolean object telling you if the current user has Liked that page or not.

No need to deal with authentication, extended permissions, or any FQL.

问题回答

暂无回答




相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签