带有计数的紧凑 Facebook 分享按钮?

发布于 2024-10-02 06:40:31 字数 577 浏览 3 评论 0原文

我正在尝试在我的网站上添加一个简单紧凑的 fshare 按钮。我发现的唯一代码是这个:

<div style="float:left;padding:4px;">
<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/>  
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"/>
</div>

应该渲染为

fshare

但它的渲染不正确。它似乎试图创建多个按钮并“崩溃”所有页面。它会破坏 HTML,更改整个 div 的背景等等...

fsharecrash

这是为什么?这是正确的代码吗?

I am trying to add a simple compact fshare button on my website. The only code I found was this one:

<div style="float:left;padding:4px;">
<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/>  
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"/>
</div>

Which should render as

fshare

But it is not redering correct. It seems it is trying to create multiple buttons and "crashes" all the page. It corrupts the HTML, change the background of a entire div and so on...

fsharecrash

Why is that? Is this the correct code?

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

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

发布评论

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

评论(3

小女人ら 2024-10-09 06:40:31

Facebook 不再建议使用分享按钮,而是应该使用点赞按钮。以下是他们在网站上的说法:

我们不建议使用“分享”按钮
对于新开发人员。如果你不是
已经使用共享按钮,我们
建议您迁移到“赞”
按钮和 Open Graph 协议代替
共享用于共享您的页面
网站。点赞按钮更简单
用户,是推荐的解决方案
继续前进。

通过“赞”按钮,您可以使用 javascript 或 iframe 添加它,这样您就可以看到哪一个最适合您。在此处了解有关“赞”按钮的更多信息。

Facebook is not recommending the use of the share button anymore, instead you should use the like button. Here is what they say on their website:

We don't recommend the Share button
for new developers. If you aren't
already using the Share button, we
recommend you migrate to the Like
button and Open Graph protocol instead
of Share for sharing pages from your
website. The Like button is simpler to
user and is the recommended solution
moving forward.

With the like button, you can add it using javascript OR iframe, so you can see which one works best for you. Read more about the like button here.

网名女生简单气质 2024-10-09 06:40:31

http://sharethis.com 提供了一个小部件,允许您包含各种社交媒体网站的按钮,包括 fb 共享按钮与计数。 (它有自己的样式和大小,因此您可能需要覆盖一些 CSS,使其看起来像标准 FB 共享。)http://blog.pixert.com/facebook-share-button/,但我无法让它显示计数。

http://sharethis.com provides a widget that allows you to include buttons for various social media sites, including the fb share button with count. (It has their own style and size so you may need to override some of the CSS to make it look like the standard FB share.) There is also a solution at http://blog.pixert.com/facebook-share-button/, but I have not been able to get it to display a count.

哆兒滾 2024-10-09 06:40:31

将您的代码更改

 <a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/> 

<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'>Share</a>

Change your code

 <a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/> 

to

<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'>Share</a>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文