Facebook Open Graph 对象数据未显示在动态消息或时间轴中

标签 facebook facebook-opengraph feed facebook-timeline

我有一个 Facebook 应用程序,其中包含已批准的操作“回复”和对象“问题”。当我单击为操作创建的按钮时,操作数据会显示在我的时间轴中,但对象的元数据不会显示,并且我的新闻源中不会显示任何内容。可能是什么原因造成的?

操作代码:

function postResponse(num,questionnum) {
        var responsestr = document.forms['frm'+num].responsestr.value;
        FB.api('/me/smartassbuddha:respond_to' + question=http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=1&qn='+questionnum+'&re='+encodeURI(responsestr),'post',
                    function(response) {
            if (!response || response.error) {
                alert('Error occured');
            } else {
                alert('Post was successful! Action ID: ' + response.id);
                }
        });
    }

对象元数据:

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# smartassbuddha: http://ogp.me/ns/fb/smartassbuddha#">
  <meta property="fb:app_id"               content="213040448788033" /> 
  <meta property="og:locale"               content="en_US" />
  <meta property="og:type"                 content="smartassbuddha:question" /> 
  <meta property="og:url"                  content="http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=<?=$chapter?>&qn=<?=$quenum?>&re=<?=$responsestr?>" /> 
  <meta property="og:title"                content="Chapter 1 - Inspiration" /> 
  <meta property="og:description"          content="<?=$questions[$quenum]?>" /> 
  <meta property="og:image"                content="http://www2.3tierlogic.com/smartassbuddha/images/logo.jpg" /> 
  <meta property="smartassbuddha:response" content="<?=$responsestr?>" /> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

最佳答案

您缺少一个问号(显然还缺少一个勾号)。您的 URL 编码也存在问题。

它应该看起来像这样:

var responsestr = document.forms['frm'+num].responsestr.value;
var url='http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=1&qn=' + questionnum + '&re=' + responsestr;

FB.api('/me/smartassbuddha:respond_to?question=' + encodeURIComponent(url),'post', function(response) {
  if (!response || response.error) {
      alert('Error occured');
  } else {
      alert('Post was successful! Action ID: ' + response.id);
  }
});

关于Facebook Open Graph 对象数据未显示在动态消息或时间轴中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9370225/

相关文章:

php - 向非 Facebook 用户显示 Facebook 帖子

facebook - Phonegap 应用程序 : Problems with Facebook login via native SDK or via CordovaWebView

Facebook oauth 授权 URL 和参数选项

facebook-graph-api - Open Graph 操作需要多长时间才能从 'pending' 获得批准?

installation - 如何利用WPI来分发我们的软件?

facebook - 如何使用 facebook API 获取公共(public)墙贴

android - 创建 Open Graph 故事时出现问题 : "unable to generate story" and "failed to generate preview"

ios - facebook - 获取点击 FB 共享链接的用户上下文

jquery - 通过 jQuery 提取和使用内容

mysql - 使用 Redis 作为事件流的键/值存储