tags:

views:

231

answers:

0

Hi all,

writing my first facebook webapp and i have some questions. I'm using their new Graph API + JS library.

The idea is that in order to use my webapp, user has to 'Like' facebook page A.

Suppose user is logged in. I have to check if he 'likes' page A. If user doesn't like that page, i display 'fan box' via

FB.XFBML.parse('<fb:fan profile_id="A's id" stream="0" connections="0" width="450"></fb:fan>');

Now, this fan box with 'Like' button is rendered in iframe that has src set to facebook domain.

Problem: i want to know when user clicks on 'Like' button so that i can display the rest of my webapp. The only possible solution that i can think of is polling every second facebook graph server which is really bad.

  • i can't attach 'onClick' event on that button cause it's inside iframe pointed to facebook domain (can't access it at all using JS)
  • i tried getting the contents of this iframe from my server and display it in iframe with empty src property so that i can access its elements - doesn't work, fan box is messed up.
  • There is no way that i know of to send 'i want to like that page' request to Graph server on behalf of the user.

I'm stumped. I really doubt that polling is the right way to solve this problem :)

related questions