Facebook iFrame标签为我工作,但对其他人来说似乎是空白的



我正在尝试为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应用程序,我也遇到过类似的问题,但它坏了几个小时,然后突然就工作了。

我整天都在摆弄这个代码和应用程序设置,甚至改变了index.php的权限,在iframe中被调用到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

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

相关内容

最新更新