show message when like button is clicked?

后端 未结 1 1526
遥遥无期
遥遥无期 2021-01-29 00:07

I am using the following code to alert the user when he click the facebook like button. It is alerting the user only on Opera browser. How do I fix this problem and make it work

1条回答
  •  青春惊慌失措
    2021-01-29 00:57

    Where did you put this code ?

    For me you have to put this in the init like this :

    window.fbAsyncInit = function() {
        FB.init({
          appId  : APP_ID,
          status : true, 
          cookie : true, 
          xfbml  : true 
        });
    
        FB.Event.subscribe('edge.create',
            function(response) {
                alert("You liked the URL");
            }
        );    
    };
    

    If you have already call the FB.init, you have to use a trick like this :

    
    

    0 讨论(0)
提交回复
热议问题