【问题标题】:Facebook share to refer back traffic to the iframe page tabFacebook 分享以将流量引回 iframe 页面选项卡
【发布时间】:2012-12-04 18:53:20
【问题描述】:

这就是我所追求的。我有一个运行网站内容的 FB 页面标签 https://site.com/

我设置了一个 FB 分享链接来分享一个页面 aboutus.html。当我分享它时,FB 允许我分享这个 URL https://site.com/aboutus.html,但我怎样才能将流量直接发送到 iFrame页面标签?例如https://www.facebook.com/fan_page/app_331267943480920398/whatever_aboutus.html

我知道这是可能的,因为我有一天看到它 - 现在不记得在哪里了。

谢谢。

【问题讨论】:

    标签: facebook url share


    【解决方案1】:

    您不能以这种方式传递文件名,这仅在 Canvas 应用上受支持。

    复制此问题的最佳解决方法是使用app_data 参数。基本上,让您的登录页面(在您的应用程序设置中定义)是某种服务器端脚本,它监听Signed Request,特别是 app_data 参数。然后你让那个脚本根据它的内容加载内容。

    举个例子,假设我要加载 http://mybasedomain.com/foo.phphttp://mybasedomain.com/bar.php。我将用户引导至 https://www.facebook.com/PAGENAME/app_APPID?app_data=foohttps://www.facebook.com/PAGENAME/app_APPID?app_data=bar,然后打开我的登陆页面,我有一个简单的 if/else 语句来解析它并呈现相关内容 -

    <?php
    
    // Assumes you have this parse_signed_request function - https://gist.github.com/872837
    // And a $config array, which contains your app_secret
    
    $signed_request = parse_signed_request($_REQUEST['signed_request'], $config['AppSecret']);
    
    if ($signed_request['app_data'] === 'foo') {
        include('foo.html');
    } else if ($signed_request['app_data'] === 'bar') {
        include('bar.html');
    } else {
        include('index.html');
    }
    

    【讨论】:

    • 谢谢科尔姆,我想这就是我想要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    相关资源
    最近更新 更多