简体   繁体   中英

Facebook comments plugin - How to login

I am adding the facebook comments plugin to my website and have little coding knowledge.

I have added the following after the opening body tag:

<script>
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.11';
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

And the following where I want the comments to display:

<div class="fb-comments" data-href="https://www.bbuboxing.co.uk/featherweight.html" width="100%" data-width="100%" data-numposts="5">

If I or a visitor is not logged in to Facebook, the plugin displays a button saying log in to post but I can't click it to log in, the button isn't clickable.

How do I make it so that I(or a visitor) can click this button to log in?

you're missing your app id which needs to be appended to the end of the src property in the sdk script tag like this:

<script>
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.11&appId=XXXX';
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

replacing the XXXX with your registered facebook app id. if you haven't registered an app yet visit https://developers.facebook.com/ and go through the registration and signup process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM