2012-11-14 55 views
8

更新:所以这是很大的。如果您尝试使用类似按钮链接到任何Facebook页面,则不起作用。尝试去Facebook的创建页面(http://developers.facebook.com/docs/reference/plugins/like/)并输入任何Facebook页面的URL(如Stackoverflow的:http://www.facebook.com/stackoverflowpage)。Facebook Like button显示0赞赞所有Facebook页面

此代码工作正常,直到今天早些时候,现在我完全失去了为什么它已停止工作。类似的按钮加载,但你不能喜欢它,或发送一条消息,它的计数是0(它应该在350左右)。

这是jsfiddle。这很简单:http://jsfiddle.net/rqR6C/

每隔一段时间,只有谷歌浏览器的控制台中出现错误。我发现其他一些人也遇到了同样的错误信息,他们也说这是间歇性的。这里的错误:

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>​ 
+0

你的'fb-root' div在哪里?浏览器控制台中是否有任何错误消息? – Phil

+0

此外,可能只是与在jsfiddle上托管代码有关,但我看到此错误消息; “应用程序配置不允许给定URL:应用程序的设置不允许使用一个或多个给定的URL,它必须与网站URL或Canvas URL匹配,或者该域必须是其中一个应用程序域的子域“。 – Phil

+0

该错误只发生在谷歌浏览器中,间歇性发生。我无法让它出现在Safari的控制台上。我在chrome中添加了fb-root和我的控制台我遇到了这个错误:请求访问的框架将'document.domain'设置为'facebook.com',但被访问的框架没有。两者都必须将'document.domain'设置为相同的值以允许访问 – Colin

回答

6

UPDATE:谁在Facebook的工作证实这是一个错误,现在它只是被固定的朋友。这里的星巴克页面为后人截图:

Starbucks.com has 0 FB likes


事业的零喜欢被具有fb:like HREF设置为你的Facebook页面。这是一个错误,为Facebook docs for the plugin officially state

Can I link the Like button to my Facebook page?

Yes. Simply specify the URL of your Facebook page in the href parameter of the button.

别人注意到了这个位置上的SO - Adding your Facebook Fan Page URL to the LIKE button doesnt work anymore?

Facebook上做了recent announcement about Like migrations(2011年 - 11月-7),所以它看起来像他们打破了东西正在进行中。

我已经添加了一条<meta property="fb:app_id" content="..." />行,其中应用程序ID是从https://graph.facebook.com/(不知道这是否正确)。没有帮助。仍然无法指向我们的粉丝页面。

试图向Facebook报告此问题是徒劳无益的。 Known Issues page似乎在很大程度上被放弃,但在“告诉我们更多”下有Facebook Business Pages的联系表。我建议尽可能多的人用这种形式来报告这个问题。这是我的报告:

Since the Nov. 7 migration of the like plugin, linking the Like button to a Facebook page will show zero likes for that page. Examples include http://fundersandfounders.com/ (which links to https://www.facebook.com/fundersandfounders with 17,000 likes).

+0

是啊,看起来现在不可能做到这一点。任何想法是暂时的或不是? – Colin

+0

我原本接受了这个答案,但我认为它只回答了“为什么”的问题,而不是“如何”的问题。我也对这个Facebook页面所说的关于我们所有人努力完成的事情感到困惑;将Facebook页面链接到网站上的链接按钮。这是不可能的还是它真的很复杂? – Colin

+0

我还没有找到解决这个问题的方法,我不确定这是Facebook上的一个瞬间错误,还是他们刚刚禁用链接到Facebook页面。所以我不认为我的答案应该被接受。还请注意,它是不可能的[合并喜欢的粉丝页喜欢的URL](http://stackoverflow.com/questions/9984330/merging-a-websites-likes-into-a-bookbook-page )。 –