0

所以这就是我所追求的。我有一个运行网站内容的 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

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

谢谢。

4

1 回答 1

0

您不能以这种方式传递文件名,这仅在 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');
}
于 2012-12-04T22:56:02.610 回答