I speak any facebook fan page.
My aim is: I want to redirect "home (welcome) page of my fan", when i select facebook like button. Also, anytime i go to this fan page, again redirect home page. So, doesn't redirect fan wall page. So, home is main page. is it possible? (I know it is silly, but I want to learn it)
I think it is impossible. Facebook API lets you create applications which you have to launch. Adding events for I like button pressed is something that Facebook API don't let you modify.
I'm not sure I understand the question correctly...but if you are looking to subscribe to the "like" event, you can in fact do that:
FB.Event.subscribe(‘edge.create’, function(response) {
// do whatever you want after the like event
});
Related
I was wondering how do they create the page on facebook with like button as a gateway to enter and browse through the page...
Here is the one example....
http://www.facebook.com/Diesel?sk=app_168523776552050
I know how to create page in iframe and put in in facebook but I dont know how they show this popup and how do they show it for non fan visitors.
Please enlighten me with your ideas and works.....
This is a simple "Fan Gate", and on the none-fan version they show the normal like button via the url of the page.
A simple way to build a fan gate yourself is described here: http://www.chilipepperdesign.com/2011/02/15/reveal-fan-gate-like-gate-facebook-iframe-tab-tutorial-with-php
The like button:
<fb:like href="http://www.facebook.com/diesel" send="true" width="450"
show_faces="true"></fb:like>
try this:
authenticate your application and get an access token
use access token to authenticate your user and to get a 'signed request' from FB.
'signed request' will tell you whether the user is fan or not
write some code: if (user is fan) { show content for fans }
else { show content for visitors }
Nothing happens without the 'signed request'. Works in PHP and JS.
Parse the 'signed_request' parameter from Facebook. See http://developers.facebook.com/docs/howtos/login/signed-request/
Each signed request contains a 'page' key with a 'liked' subkey whose value is a bool of whether the page has been liked.
Display the banner depending on the value of that bool.
Note that only the Page Tab view has a like button on it. The Canvas App does not have a like button surrounding it.
I have a Facebook page.
We will start a giveaway. And we will give gifts to our Facebook Fans . They will give a promo code if like our page. BUt we want to sure, they are really fan of our fan page.
Because of this, I want to create a new tab which say "You have to like this page for get promotion code" to user . When visitor like our page, he / she can see content tab. If not, they can't see.
It was easy on static FBML, but know how can i do it with iFrame ? My tab is ready. Created a new app and then this app added to page.
you need to parse the signed_request parameter, it has a Boolean attribute called liked.
you may want to look at this question
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.
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.