Facebook的“喜欢”按钮和#URL字符串? [英] Facebook 'Like' buttons and # URL strings?
问题描述
什么是Facebook的做出喜欢按钮,在AJAX的web应用程序,如果他们指的是同一个网页,但使用不同#字符串?
What does Facebook make of 'Like' buttons in a ajax web app if they are referring to the same page but with a different # string?
是否把它们作为不同的页面,以喜欢?
Does it treat them as different pages to 'like'?
例如,如果我得到4样点击:
for example if i get 4 like clicks:
mysite.com/articles#story1
mysite.com/articles#story2
mysite.com/articles#story3
mysite.com/articles#story4
什么会在用户的新闻源
what will come up in the users' newsfeed
4 people like mysite.com/articles
或
dave likes mysite.com/articles#story1
tom likes mysite.com/articles#story2
ben likes mysite.com/articles#story3
nick likes mysite.com/articles#story4
还有什么其他的事情要考虑与FB和#字符串?
are there any other things to think about with FB and # strings?
推荐答案
Facebook的喜欢按钮使用嵌入在一个网页的HTML标记的元数据。它在被卷曲访问这样就在理论上,如果你的网址产生不同的元数据(即没有JavaScript的,我相信这是不可能的,因为哈希部分是没有看到服务器端,所以没有办法采取行动哈希字符串值服务器端)。
Facebook's like buttons use metadata that are embedded in the HTML markup of a single page. It would work in theory if your URL's produce different metadata when accessed by curl (i.e. without JavaScript, which I believe is not possible since the hash portion is not seen server-side, so there is no way to act on hash string values server side).
所以话说回来,我会认为Facebook的喜欢按钮没有不同的表现为不同的hash字符串。一看Facebook的文件(其中大部分是很烂)犯规提到这一点,但Facebook的开发者论坛似乎证实了这一点:<一href="http://forum.developers.facebook.com/viewtopic.php?pid=240151">http://forum.developers.facebook.com/viewtopic.php?pid=240151
So having said that, I would assume that Facebook Like buttons don't behave differently for different hash strings. A look at the facebook documentation (which mostly sucks) doesnt mention this, but the facebook developer forums seem to confirm this: http://forum.developers.facebook.com/viewtopic.php?pid=240151
然而,一切都没有失去。您可以指定一个类似按钮的URL,因此只需将URL设置为相同页面的搜索引擎友好的网址:<一href="http://developers.facebook.com/docs/reference/plugins/like">http://developers.facebook.com/docs/reference/plugins/like
However, all is not lost. You can specify the URL of a like button, so just set the URL to be the SEO-friendly URL of the same page: http://developers.facebook.com/docs/reference/plugins/like
所以,现在我们知道你的哈希字符串的URL静态版本。之前,你最有可能将类似按钮的页面与此code:
So, now that we know you have static versions of the hash string URLS. Before, you were most likely placing like buttons on the page with this code:
XFBML:
<fb:like show_faces="false" width="450"></fb:like>
相反,你应该指定URL的搜索引擎优化的版本。例如,当你在 mysite.com/articles#story4 ,在code应该是这样的:
Instead, you should be specifying the SEO version of the URL. For example, when you're on mysite.com/articles#story4, the code should look like:
XFBML:
<fb:like href="mysite.com/articles/story/4" show_faces="false" width="450"></fb:like>
这篇关于Facebook的“喜欢”按钮和#URL字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!