Skip to content Skip to sidebar Skip to footer

Fb Like Button Edge.create Event Not Firing After Login

I have fb like button on my site, below is my code

You have to check for auth.login instead of edge.create. Inside the auth.login callback call the edge.create action. Inside the edge.create action you can now define your callback to redirect or do anything you like.

//If not logged inFB.Event.subscribe('auth.login', login_event);
//If already logged in just call edge.createlogin_event();

//edge create eventvar login_event = function(){
    FB.Event.subscribe('edge.create', page_like_callback);
}

var page_like_callback = function(){
    //Do your stuff
    location.href = url;
}

I know this is pretty dirty but like this my like-gate works fine on desktop browsers. The only problem is if the user is not logged in but already liked your page - you won't be able to catch this case sadly.. But I agree - edge.create not triggering if not logged in seems to be a bug imo as well.

Btw. I'm using the auto init function instead of the FB.init()..

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appID=12321321321321&version=v2.0";

Post a Comment for "Fb Like Button Edge.create Event Not Firing After Login"