Facebook 分享按钮

发布于 2024-10-24 03:23:33 字数 40 浏览 4 评论 0原文

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

How to get facebook share button? Now a days they not showing to get code..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

帅气称霸 2024-10-31 03:23:33

首先在标签中定义一些属性,如下所示:

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

通过此您可以添加共享按钮。

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.

末が日狂欢 2024-10-31 03:23:33

尝试添加此按钮。只需谷歌即可。

try the addthis button. just google for it.

往事风中埋 2024-10-31 03:23:33

您必须将 facebook 开发者收到的“app_id”插入到 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 开发者网站,“URL 重定向”部分。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文