开发者

Facebook share button

How 开发者_开发知识库to get facebook share button? Now a days they not showing to get code..


firstly defined some attribute in your tag like this:

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

after that use this code:

> <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>

By this you can add share button.


try the addthis button. just google for it.


You have to insert your 'app_id' received by facebook developer into 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>

Check out facebook developers site, section 'URL Redirection'.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜