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 :)
You can get the onclick event by using the fbml code of like button instead of iframe code.
Facebook provides FB.event.subscribe which triggers when somebody clicks like button.
A complete tutorial is here.In your case you can write the code to refresh the page on like button click. and check for like condition on page load. so that if current user has liked the page you can redirect him to application page.
Related
OK, I have the standard Facebook Like code.
But we are ajaxing in Tumblr posts from the Tumblr feed and putting the FB Like button in.
So we are LIKING the Tumblr post URL.
However the page is not on a Tumbler URL, so FB momentarilly shows the comments box, then replaces it with a Confirm button, which triggers a popup. Like in the popup, then it allows you to use the normal JS comment that should appear on the button.
QA and UI have flagged this up as unacceptable, so is this a massive UI failing by FB? Whatever it is, and how can I get around it?
If we LIKE a unique URL on our site/domain this works as intended;
BUT THEN we would have to write a backend to receive that URL and present OG tags for FB to scrape, probably grabbing from the tumblr post.
Yes, by default the Like plugin it will search the page for og:metadata,
to go forward you can use the new build in, Open Graph Like Action
http://developers.facebook.com/docs/opengraph/actions/builtin/likes/
So, now you can associate each Open Graph object with a like.
I'm hoping that someone can help me out with this problem that I've been trying to solve all day. It appears as though there is a new 'Like' button on certain Facebook Fan Pages. When a user hits this button a dialog box appears that says.... "Help your friends discover great places to visit by writing a recommendation for 'Fan Page Name'". There is space to include a recommendation and 2 buttons; 'recommend' or 'skip'.
My team have developed a fangated promotion for this client (which lives on a separate canvas page). With the typical 'Like' button functionality the user likes the page and is automatically taken to the canvas page promotion. As a result of this new 'Like' button (whether the user chooses to recommend or not) the are automatically redirected back to the main Wall and can only access the canvas promotion by clicking on the correct icon in the left column.(Needless to say this is resulting in a lot of traffic being lost.)
I have 3 questions here;
Any ideas on how to remove this 'Recommend' dialog box and revert back to the normal 'Like' button
Does anyone have any suggestions on how to allow the user click 'Like' (recommend or not) and arrive at the correct canvas page without the redirect back to the Wall?
Do you have any insight on how FB are choosing which pages to roll this new 'Like' button out to?
Thanks in advance!
It's a facebook bug for places pages
temporary workaround is to remove the address from your fan page ... still looking for a coding workaround so please post if you have one!!
I am planning to create some dynamic content in a Facebook tab for my fan page. It should have content displayed if the visitor is not a fan, and then upon them clicking the Like button, changing the content to display hidden carrots (metaphorically). Is it possible to capture the event of the click on the Like button from inside the iframe?
On a Facebook fan page, when the user clicks the Like button, the whole page gets reloaded and Facebook sends an HTTP post to your website with a parameter called signed_request that you would need to decode and look at with server code, not javascript. The code to decode it will obviously vary depending on what language you are using, but the process is documented on Facebooks site. Once decoded, you will need to look at the page.liked value.
I have created an app that will be used as a tab on my company facebook fan page. I have a new requirement to capture when the user clicks the like button on the facebook fan page and hide a portion of the app page (within the iframe) when the event fires. Although the like button is on facebook's page, is there a way to capture the click event of the like button (ie: javascript sdk) within my app iframe so I can hide appropriate elements?
Like this .... http://www.facebook.com/redbull
Thanks for any and all advice,
B
I found the answer...
How to detect Facebook Like button pressed and trigger event?
I checked the incoming request for fb_sig_is_fan.
I am afraid that this is not possible. Also it makes no sense! because Facebook will reload the page once you click on the like button!
Is this possible?
When someone clicks a Facebook Like button, he/she shares the web page URL with friends on Facebook.
With the same click, the user also becomes a fan of the web site's Facebook fan page.
Thanks!
While adding a Like button on your website to like you "Facebook Page" is possible (and I guess you know that), you can't use the same button to like multiple entities (your current page and the Facebook Page).
What you can do is:
Have two Like buttons, one for the current page and one for the Facebook Page
Place the Like button of your Facebook Page in a "visible" location (e.g. on top of the sidebar)
Capture the like event of your current page (with edge.create)
Encourage the user to "Become a Fan on Facebook too" whenever they like your current page.
See this link on Facebook's developer site.
This will do all the points 1 and 3 you mentioned above. As far as point 2 goes, you will need to reference that on your facebook page.