How To Make The Facebook Like Button Display None When Logged In As Page

前端 未结 4 1524
余生分开走
余生分开走 2021-01-25 03:56

I have the Facebook like button on my site http://theganjagirls.com ... everything looks and works fine when I\'m logged into my Facebook account... But when I\'m logged in as a

相关标签:
4条回答
  • 2021-01-25 03:59

    You could use a little script to set a timeout function and check the width of the widget

    var timer;
    $(window).load(function () {
        window.clearTimeout(timer);
        timer = window.setTimeout(function () {
            if ($('.fb-like').width() === 0) {
                $('.fb-like').hide();
                console.log('face');
    
            }
        }, 1000); // using 1000 milliseconds to work around load race
    });
    

    Working Example

    Be aware you may run into a load-race. If the script runs before the widget loads this method may fail...

    0 讨论(0)
  • 2021-01-25 04:06

    I don't believe you can do that. Unless Facebook has made code for it, You can't just check for yourself.

    Please remember that if you put in the default code for a Facebook like button, it will respond appropriately if the user is logged in.

    Good luck!

    0 讨论(0)
  • 2021-01-25 04:17

    put the icons in a container and apply the following css:

    <style>.social-container{width:1px;height:1px;overflow:hidden}</style>
    
    0 讨论(0)
  • 2021-01-25 04:18

    Wouldn't this: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/ (for getting the logged in status) combined with this: Facebook: get list of pages that a user is admin of (for getting the pages the user is admin of) be solution to your problem?

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