我无法通过 Facebook Like 按钮获得一致的行为。我创建了这个示例,我认为这是最简单的实现...
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Untitled Page</title>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1" type="text/javascript"></script>
</head>
<body>
<fb:like href="http://www.stackoverflow.com" layout="button_count" show_faces="false" width="450" font=""></fb:like>
</body>
</html>
我已将其保存为 HTML 文件,我从运行在我的计算机上的网络服务器提供该文件(本地主机 - 我认为这不会成为问题,因为在这个例子中我“喜欢”的页面是面向公众的)。
如果我在 Google Chrome 中尝试此操作,它似乎可以正常工作。
当我在 IE9 中尝试时,会呈现“点赞”按钮,但当我单击它时,会打开一个新的 IE 窗口,除了蓝色的 Facebook 标题之外,该窗口大部分是空白的。此页面的 URL 为: http://www.facebook.com/connect/connect_to_external_page_widget_loggedin.php?social_plugin=like&external_page_url=http%3A%2F%2Fwww.stackoverflow.com%2F
这真的让我很困惑例子就这么简单!任何帮助将非常感激!
编辑:更多信息。如果我在 IE9 中访问 Facebook 并注销,然后再次尝试我的“喜欢”按钮,仍然会打开一个新窗口,但这次我可以登录。但登录后,我仍然会看到同一个空白页面。
I am having trouble getting consistent behaviour from my Facebook Like button. I have created this example which I believe to be the simplest possible implementation...
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Untitled Page</title>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1" type="text/javascript"></script>
</head>
<body>
<fb:like href="http://www.stackoverflow.com" layout="button_count" show_faces="false" width="450" font=""></fb:like>
</body>
</html>
I have saved this as an HTML file which I am serving from a webserver running on my machine (localhost - I assume this won't be a problem as the page I'm 'liking' in this example is public-facing).
If I try this in Google Chrome, it appears to work without a problem.
When I try it in IE9, the like button renders, but when I click it, a new IE window opens which is mostly blank apart from a blue Facebook header. The URL of this page is: http://www.facebook.com/connect/connect_to_external_page_widget_loggedin.php?social_plugin=like&external_page_url=http%3A%2F%2Fwww.stackoverflow.com%2F
This is really confusing me as the example is about as simple as it gets! Any help would be really appreciated!
EDIT: A little more information. If I go to Facebook in IE9 and log-out, then try my like button again, a new window still opens but this time I can login. After logging in, though, I still get taken to the same blank page.
发布评论
评论(1)
无奈之下,我尝试从 http://127.0.0.1 而不是 http://localhost
这似乎已经解决了(或至少解决了)问题。
我很乐意听到任何人能解释这到底是怎么回事!
In desperation, I tried accessing my local page from http://127.0.0.1 instead of http://localhost
This appears to have solved (or at least worked around) the problem.
I would love to hear from anyone who can explain what this is all about!!