1

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

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

但是共享图片下还有另一个网址,请参阅下图了解更多信息 在此处输入图像描述

因此,在图像中存在环绕链接,因此它指向其他页面,而我希望它指向应用程序的第一页。它目前进入这样的页面:http ://apps.facebook.com/apps/application.php?id=xxxxxxxxxxxxx

那么任何人都可以告诉我在哪里可以指定该 URL?

提前致谢

4

2 回答 2

3

根据 facebook 即将弃用所有 FBML 应用程序,我建议您查看这里,并尝试以这种方式创建一个对话框。我可以给你我目前正在使用的脚本,你圈出的链接指向我的应用程序的主页。应该记下 - 我的应用程序是 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
于 2011-02-01T08:40:10.293 回答
1

好的 Hafiz 然后试试这个代码。

FB.ui({
    方法:'stream.publish',
    消息:'你好',
    附件: {
      名称:标题,

      标题:“我在跑!”,
      媒体: [{
        类型:'图像',
        href: 'http://www.yoursite.com/',
        src:'http://www.yoursite.com/images/working.jpeg'
      }]
    },
    动作链接:[{
      text: '得到你的百分比',
      href: 'http://www.yoursite/'
    }],
    user_message_prompt: '告诉你的朋友获取你的百分比:'
  });
于 2011-02-01T08:24:05.820 回答