更新:所以这很大。如果您尝试使用“赞”按钮链接到任何 Facebook 页面,则不会起作用。尝试访问 Facebook 之类的创建页面 (http://developers.facebook.com/docs/reference/plugins/like/) 并输入任何 Facebook 之类页面的 URL(如 Stackoverflow 的:http://www.facebook.com/stackoverflowpage http://www.facebook.com/stackoverflowpage).
这段代码直到今天早些时候都工作正常,现在我完全不知道为什么它停止工作了。点赞按钮会加载,但您不能点赞或用它发送消息,并且点赞计数为 0(应该在 350 左右)。
这是jsfiddle。这很简单:http://jsfiddle.net/rqR6C/ http://jsfiddle.net/rqR6C/
我经常且仅在 Google Chrome 的控制台中收到错误。我发现其他一些人也遇到过同样的错误消息,他们也说这是间歇性的。这是错误:
The frame requesting access set 'document.domain' to 'facebook.com', but the frame being accessed did not. Both must set 'document.domain' to the same value to allow access.
代码:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
// Init the SDK upon load
window.fbAsyncInit = function() {
FB.init({
appId : '464723870207650', // App ID
channelUrl : '//'+window.location.hostname+'/channel.php', // Path to your Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
frictionlessRequests: true
});
}
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<div class="fb-like" data-href="http://facebook.com/pages/Grouptonescom/160798537354204" data-send="true" data-layout="button_count" data-width="180" data-show-faces="false"></div>