简体   繁体   中英

Like a specific post of the timeline of a Facebook page from an external website

I've some trouble with the Like Button. I would like to like a specific post like this one from a external website but it doesn't work: https://www.facebook.com/236086869778323/posts/597301643656842 For this button I used the following code, which is given by Facebook Developers

<div id="fb-root"></div>
<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 = "//connect.facebook.net/de_DE/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>



<div class="fb-like" data-href="https://www.facebook.com/236086869778323/posts/597302473656759" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

When you read the documentation about the Like Button it states

A single click on the Like button will 'like' pieces of content on the web and share them on Facebook. You can also display a Share button next to the Like button to let people add a personal message and customize who they share with.

These pieces of content are external. That is the Like Button is intended to be used for webpages outside of Facebook to share in Facebook.

You will need to use Embedded Posts instead https://developers.facebook.com/docs/plugins/embedded-posts/

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