设置Facebook发布流URL

时间:2011-01-31 11:07:31

标签: facebook facebook-wall

我在Facebook FBML应用程序中使用facebook publishStream方法,其他一些开发人员在我之前处理过它。我正在使用它这样的东西

Facebook.streamPublish('Publish Shirt Tale. <?php echo $canvasURL.'?req=tale-details&tale_id='.$tale_id?>', attachment);

但共享图片下还有另一个网址,有关详细信息,请参见下图 enter image description here

因此在图像中有环绕链接,所以当我想要它到app的第一页时指向其他页面。它目前在某个页面上有这样的内容:http://apps.facebook.com/apps/application.php?id=xxxxxxxxxxxxx

所以任何人都可以告诉我在哪里可以指定该网址?

提前致谢

2 个答案:

答案 0 :(得分:3)

根据facebook deprecating all FBML apps soon,我建议您look here,并尝试以这种方式创建对话框。我可以给你我正在使用的脚本,你圈出的链接指向我应用的主页。应该做一个注释 - 我的应用程序是一个Iframe应用程序。

    <script type="text/javascript">
    FB.ui(
  {
    method: 'stream.publish',
    attachment: {
      name: 'name',
      caption: 'caption',
      source: 'picture.jpg',
      picture: 'picture.jpg',
      description: 'description',
      href: 'http://apps.facebook.com/appname'
    },
    action_links: [
      { text: 'name', href: 'http://apps.facebook.com/appname' }
    ]
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);
    </script>

如果您希望将应用程序保留在FBML表单中,请尝试以下代码:

    <script type="text/javascript">
    FB.ui(
  {
    method: 'stream.publish',
    attachment: {
      name: 'name',
      caption: 'caption',
      source: 'picture.jpg',
      picture: 'picture.jpg',
      description: 'description',
      href: 'http://apps.facebook.com/appname/index.php'
    },
    action_links: [
      { text: 'name', href: 'http://apps.facebook.com/appname/index.php' }
    ]
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);
    </script>

您需要了解Iframe和FBML应用程序之间的区别:虽然Iframe应用程序使用户始终处于同一页面,并且只有Iframe中的内容发生更改,但FBML应用程序实际上会将用户从一个页面移动到另一个页面。因此,在FBML应用中指定链接时,使用http://apps.facebook.com/appname/page链接而不是http://www.yoursite.com/page链接非常重要。

示例链接:

  1. 您网站上的链接:http://www.yoursite.com/game1.php
  2. 在FBML应用中看起来像这样:http://apps.facebook.com/appname/game1.php

答案 1 :(得分:1)

好吧哈菲兹然后试试这段代码。

FB.ui({
    method: 'stream.publish',
    message:'hello',
    attachment: {
      name: title,

      caption: "I'm running!",
      media: [{
        type: 'image',
        href: 'http://www.yoursite.com/',
        src: 'http://www.yoursite.com/images/working.jpeg'
      }]
    },
    action_links: [{
      text: 'Get your percentage',
      href: 'http://www.yoursite/'
    }],
    user_message_prompt: 'Tell your friends about Get your percentage:'
  });
相关问题