开发者

Hide counter on FaceBook Like button

开发者 https://www.devze.com 2023-04-09 22:48 出处:网络
I have simple html page with FaceBook Like button: <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//E开发者_StackOverflow社区N\"\"http://www.w3.org/TR/html4/loose.dtd\">

I have simple html page with FaceBook Like button:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//E开发者_StackOverflow社区N"  "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

<div id="fb-root"></div>
<script type="text/javascript">

    window.fbAsyncInit = function() {
        FB.init({
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true, // parse XFBML
            channelURL: 'http://myurl.com', // channel.html file
            oauth: true // enable OAuth 2.0
        });
    };
    (function(d) {
        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        d.getElementsByTagName('head')[0].appendChild(js);
    } (document));


</script>

<fb:like href="http://myurl.com" layout="button_count" show_faces="false" width="450" height="35" action="like" colorscheme="light" font="trebuchet ms" allowTransparency="true"></fb:like>

</body>
</html>

How can I hide counter next to button?

Thanks a lot!


Use the iframe code provided by Facebook at http://developers.facebook.com/docs/reference/plugins/like then wrap it in a div with height and width and overflow hidden.


I've tested several versions now. a) You get many problems on different browsers, you have to check every browser version b) There is a noscript addon named "ClearClick" - it will warn/prevent users from clicking on such a hidden FB Button. There is no solution against that. Well there is 1 solution, the hidden space must be OUTSIDe the screen so ClearClick can not reender it and does not warn the user. But you do not want your like button on the top of your page I believe.


Choose standart facebook like button from John's link it will be ok! ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消