Facebook分享按钮

时间:2011-03-17 10:21:03

标签: facebook button share

如何获取Facebook分享按钮?现在有一天他们没有出示代码..

3 个答案:

答案 0 :(得分:3)

首先在您的代码中定义了一些属性,如下所示:

> <html
> xmlns="http://www.w3.org/1999/xhtml"
> xmlns:fb="http://www.facebook.com/2008/fbml">

之后使用此代码:

> <html
> xmlns="http://www.w3.org/1999/xhtml"
>   xmlns:fb="http://www.facebook.com/2008/fbml">
> 
> <head> <script
> src="http://connect.facebook.net/en_US/all.js"></script>
> <script
> src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
>   type="text/javascript"></script>
> 
> </head>
> 
> <body> <div id="fb-root"></div>
> 
> <a name="fb_share" type="box_count"
>           href="http://www.facebook.com/sharer.php"
> tabindex="-1">Share</a> <script>
> 
> //===========init javascript
> SDK===========================
> 
> FB.init({appId: 'YOUR APP KEY',
> status: true, cookie: true, xfbml:
> true});
> FB.Event.subscribe('auth.sessionChange',
> function(response) {
>     if (response.session) {
>       // A user has logged in, and a new cookie has been saved
>     } else {
>       // The user has logged out, and the cookie has been cleared
>     }   });
> 
> </script>
> 
> 
> </body> </html>

通过这个你可以添加分享按钮。

答案 1 :(得分:1)

尝试添加此按钮。只是google for it。

答案 2 :(得分:0)

您必须插入&#39; app_id&#39;由facebook开发者收到app_id:

<a href=" 
   https://www.facebook.com/dialog/share?
      app_id=your_app_id
      &display=popup
      &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
     &redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer">
<!-- your button image insert this -->
</a>

查看facebook developers site,部分&#39;网址重定向&#39;。