facebook like box: Showing sample image instead of feed when user is not logged in on facebook

亡梦爱人 提交于 2020-01-05 04:15:06

问题


I have a facebook page with age restriction (above 21) so I am aware that the like box won't be visible on my website unless the user is logged in on facebook and authenticate that he/she is above 21.

My problem is I have a div container in which I am showing the faces along with like button, but that is visible only after the user is logged in on FB. Without it my div container is empty and it looks awful. Is there any way to show a sample image on the div container if the user is not logged in on FB and clicking on that image redirect the user to facebook login page. Once the user is logged in the sample image won't be visible and only like box stream would be visible in the likebox div that I have on my website.

Here is my code

<div class="feedBlock" id="fbFeed">
    <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/nl_NL/all.js#xfbml=1&appId=591503784269841";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <fb:like-box href="https://www.facebook.com/FACEBOOK_PAGE" width="235" height="405" colorscheme="light" show_faces="true" header="false" stream="false" show_border="true">
    </fb:like-box>
</div>

CSS

.feedBlock {
    height: 405px;
    font-size: 10pt;
}

#fbFeed {
    width: 235px;
    margin: 0 15px;
}

来源:https://stackoverflow.com/questions/21985810/facebook-like-box-showing-sample-image-instead-of-feed-when-user-is-not-logged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!