Facebook SDK: Replace “Log In” button with custom image

前端 未结 1 794
孤城傲影
孤城傲影 2020-12-22 06:36

I have Page Tab App, which has a landing page with a \"Log In\" button for users to click to install the App. Can I replace the \"Log In\" button with my custom image?

相关标签:
1条回答
  • 2020-12-22 07:29

    You can use the JS Api for this,

    function fbAuth() {
        FB.login(function(response) {
          if (response.authResponse) {
            alert('User fully authorize the app.');
          } else {
            alert('User canceled login or did not fully authorize the app.');
          }
        }, { scope: 'friend_likes' });
    }
    

    then you can call it in a custom button with the onclick event:

    <a href="#" onclick="return fbAuth();">Login</a>
    

    Facebook Documentation: FB.login

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