我在 FB 粉丝页面选项卡中向基于 iFrame 的页面添加“赞”按钮时遇到问题。我正在使用 JavaScript SDK 和 Open Graph 来指定我希望用户“喜欢”的页面(这是我的 FB 页面中的当前页面)。
该页面基于 iFrame,是 FB 中的一个应用程序,可通过我的 FB 页面的 FB 页面选项卡访问。问题是 Facebook 正在将 Like 分配给我的 FB 页面本身(如果你愿意,我的 FB 页面主页)而不是有问题的页面(我的测试页面 - 它被设置为一个应用程序并出现在我的 FB 页面选项卡中的名称下“OG测试”)。
我已经尝试通过 FB linter 运行 iFrame 的目标页面,它给出了一个奇怪的错误,说我已经提供了“其他”的开放图类型(我没有,我已经在我的 META 中提供了“网站”标签)见下:
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.airport-parking-quote.co.uk%2Ffacebook%2Fog-test.php
另外,从调试页面来看,Facebook 似乎要么忽略了我的“og:url”值中的 QueryString,因此只看到了我的 FB 页面的虚 URL,或者有某种阻止能够喜欢基于 iFrame 的应用程序页。
任何人都可以对此有所了解吗?我认为从这篇文章中可以实现我想要做的事情:
http://www.insidefacebook.com/2010/09/09/like-buttons-app-content/
iFrame 目标页面的代码是:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Test Like</title>
<meta property="og:title" content="OG Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="https://www.facebook.com/EssentialTravel?sk=app_275969292428556"/>
<meta property="og:image" content=""/>
<meta property="og:site_name" content=""/>
<meta property="fb:admins" content="100002424161307"/>
<meta property="fb:app_id" content="275969292428556"/>
<meta property="og:description" content="OG test through canvas page"/>
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '275969292428556',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true // enable OAuth 2.0
});
</script>
Test Page<br>
<script src="http://connect.facebook.net/en_US/all.js#appId=156081301143077&xfbml=1"></script><fb:like href="https://www.facebook.com/EssentialTravel?sk=app_275969292428556" send="false" width="450" show_faces="false" action="recommend" font=""></fb:like>
</body>
</html>
有人有任何想法吗?
谢谢,
约丹娜
最佳答案
不幸的是,您无法为页面上的实际选项卡设置点赞按钮。
正如您所发现的,尝试使用 https://www.facebook.com/EssentialTravel?sk=app_275969292428556 之类的 url 制作一个喜欢按钮只会为页面而不是单个选项卡制作一个喜欢按钮。
为该特定选项卡制作喜欢按钮的最佳方法是仅使用位于您的服务器上的应用程序的 URL,例如。 http://YOURDOMAIN.com/YourAppDirectory
关于基于 iFrame 的 FB Pages 应用程序上的 Facebook Like 按钮 - 问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7309911/