Facebook iFrame选项卡对我有用,但对所有人来说都显得空白?

时间:2011-12-05 16:52:39

标签: php jquery facebook facebook-graph-api facebook-php-sdk

我正在尝试为Facebook页面创建一个自定义选项卡,它在页面上的选项卡中作为firefox和Internet Explorer 8以及作为直接链接完美地适用于我,但对于其他人来说它只是显示为空白。

我也是该页面的管理员,如果我尝试以其他人身份登录,那么它对我来说也是空白。

这是我的代码:

require 'src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId' => 'xxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxx',
));

$user = $facebook->getUser();

if ($user) {
try {
    $likes = $facebook->api("/me/likes/PAGEID");
    if( !empty($likes['data']) )
    {
        ?>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript">
        $(document).ready(function() {
            $('#fan').click(function() {
                $('#fan').animate({
                    opacity: 0.2,
                    width: 'auto',
                    height: 'auto'
                }, 1000, function() {
                    // Animation complete.
                    $('#fan').hide('slow');
                    $('#voucher').show('slow');
                });
            });
        });
        </script>

        <a href="#"><img id="fan" src="http://www.website.com/facebook/2011/voucher/fans_image.jpg" alt="10% off" style="border:0;" /></a>
        <div style="display:none; position:absolute; top:0; left:0;" id="voucher" >
        <a href="http://www.website.com/facebook/2011/voucher/voucher-11.pdf" target="_blank"><img src="http://www.website.com/facebook/2011/voucher/fb-voucher-dec11.jpg" style="border:0;" alt="10% off" /></a>  <br />
        <p style="text-align:center"><a href="http://www.website.com/facebook/2011/voucher/DECEMBER-11.pdf" target="_blank">Click here to download PDF version of the voucher.</a></p>
        </div>
        <?php
    }
    else
    {
        ?>
        <img style="position:absolute; top:0; left:0; border:0;" id="all" src="http://www.website.com/facebook/2011/voucher/fb_like_page.jpg" width="520" height="304" alt="Click LIKE button to get 10% off" />';
        <?php
    }
} catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
    }
}

if ($user) {
    $logoutUrl = $facebook->getLogoutUrl();
} 
else {
    $loginUrl = $facebook->getLoginUrl(array(
    'scope' => 'user_likes'
    ));
}

我过去开发过另一个Facebook应用程序,我遇到了类似的问题,但是已经破了几个小时然后突然工作了。

我一直在使用代码和应用程​​序设置来摆弄这一天,甚至将iframe中调用的index.php的权限更改为755,但它仍然显示为空白:(

更多信息 该应用程序在沙箱模式下,以下是应用程序设置:

基本

Website: Site URL: http://www.website.com/

App on Facebook: Canvas URL: http://www.website.com/facebook/2011/discount-voucher/
               : Secure Canvas URL: https://www.website.com/facebook/2011/discount-voucher/

Page Tab: Page Tab URL: index.php
          Secure Page Tab URL: index.php

高级

 App Type: Web
 Deauthorize Callback: *blank*
 Sandbox Mode: Disabled

Migrations:
Remove Deprecated APIs: Enabled
Stream post URL security: Disabled
Timezone-less events: Enabled
Upgrade to Requests 2.0: Enabled
Require manage_notifications: Enabled
Include recent activity stories: Enabled
Enhanced Auth Dialog: Enabled
page_hours_format: Enabled
Graph Batch API Exception Format: Enabled

1 个答案:

答案 0 :(得分:0)

尝试更改Page Tab URLSecure Page Tab URL以反映实际的绝对网址。