【问题标题】:Facebook - fan gate / re-direct issueFacebook - 粉丝门/重定向问题
【发布时间】:2011-08-12 17:48:32
【问题描述】:

我在 Facebook 上设置了一个业务页面。 当用户第一次到达时,他们会看到一个使用粉丝门控的自定义欢迎应用 iframe 应用。 (1) 如果用户点击 LIKE,我们将他们转发到墙上。 (2) 如果用户随后点击欢迎应用链接,他们应该能够正常查看内容。目前在欢迎应用程序上,我有一些将用户转发到墙的 javascript:

<script type="text/javascript">
if (top != self) top.window.location = 'http://www.facebook.com/abc?sk=wall';
</script>

所以问题是我只需要在用户喜欢的情况下将他们转发到 Wall,尽管之后不会继续将他们转发到 WALL,而是让他们查看实际内容。

如何在 Facebook 上做到这一点?设置cookie?

【问题讨论】:

  • 我猜这是 cookie 的工作,因为该应用程序托管在我的服务器上并在 iFrame 中捕获,我猜这不是一个选项?感谢您提供任何帮助。

标签: facebook cookies facebook-graph-api


【解决方案1】:

如果查看用户喜欢您的页面,您可以从已解析的签名请求(到选项卡 iFrame)中获得 - 内容类似于以下内容(PHP print_r 的输出):

stdClass Object
(
    [algorithm] => HMAC-SHA256
    [issued_at] => xxxxxxxxxx
    [page] => stdClass Object
        (
            [id] => FAN_PAGE_ID // target page id
            [liked] => 1        // is the user a fan
            [admin] =>          // is the user an admin
        )

    [user] => stdClass Object
        (
            [country] => ie
            [locale] => en_GB
            [age] => stdClass Object
                (
                    [min] => 21
                )

        )

)

有关详细信息,请参阅: http://developers.facebook.com/docs/authentication/signed_request/

如果用户是您页面的粉丝,则将变量 liked 设置为 1。如果不是,您可以输出重定向:

<script type="text/javascript">top.window.location = 'http://www.facebook.com/abc?sk=wall';</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-23
    • 2011-09-21
    相关资源
    最近更新 更多