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

发布于 2025-01-08 05:07:09 字数 1785 浏览 0 评论 0原文

我有一个 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" />

I have a Facebook App with an approved action 'Respond To' and an object 'Question'. When I click on the button I created for my action the action data shows in my Timeline, but the metadata for the object doesn't show and nothing shows in my News Feed. What could be causing this?

Action Code:

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);
                }
        });
    }

Object Metadata:

<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" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

养猫人 2025-01-15 05:07:10

您缺少一个问号(显然还缺少一个勾号)。您的 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);
  }
});

You are missing a question mark (and a tick mark apparently). There's also a problem with your URL-encoding.

It should look something like this:

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);
  }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文