如何把facebook和twitter的“喜欢按钮”放在我的网站上?

时间:2012-08-09 11:59:59

标签: facebook twitter

我想把facebook的“喜欢”按钮放在我的网站上,我用这个

<html>
    <head>
      <title>My Great Web page</title>
    </head>
    <body>
       <iframe src="http://www.facebook.com/plugins/like.php?href=https://www.google.com.sg/"
        scrolling="no" frameborder="0"
        style="border:none; width:450px; height:80px"></iframe>
    </body>
 </html>
然而,如果我没有登录facebook,它不起作用,有什么问题? 以及如何在twitter中实现相同的功能?

1 个答案:

答案 0 :(得分:1)

Twitter和Facebook集成的发电机可在相应公司的网页上免费获得。

但是,正如您已经写过的那样,它只有在登录时才有效。当您没有登录时,它将显示Facebook的登录页面,请参阅此处了解您的代码的工作方式:

http://jsfiddle.net/Y5WAp/

这里有一个屏幕截图,显示当我尝试不喜欢登录Facebook时会发生什么(并且应该发生):

http://i.imgur.com/U2Tgz.png